> Provoked by a discussion with Don Syme, and after some helpful > conversations at POPL, I have finally written up a proposal for adding > "view patterns" to Haskell. We've wanted views for a long time, but they > have never made it, into GHC at any rate. This proposal is a very > lightweight (and hence, I hope, cost-effective) proposal for > a view-like mechanism.
> http://hackage.haskell.org/trac/haskell-prime/wiki/ViewPatterns It's nicely simple&general, but I find it at the same time disappointing, because a pattern guard would give you almost the same result without much syntactic overhead. I.e. in the above page you give an example with a "regexp" matching function, which is great when you match only against one regexp, but as soon as you try to match against several patterns, it seems you're stuck with either matching each pattern in turn, or resorting to an external lex tool. The way I see views, they should allow you to implement lex/yacc/burg directly. Stefan _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
