Pattern guards

John Meacham john at
Sun Oct 1 19:21:20 EDT 2006

Just a few thoughts,

It is well known pattern guards can be simulated with haskell 98, I
don't think anyone has doubted that.

The need for supplemental condition testing and splitting the pattern
matching among the where clause and the boolean guards is considered
very cumbersome by some. Personally I feel it very much obscures the
intent of the programmer and comingles the body of the branch with the
matching criteria for it in an unpleasant way.

the (<-) notation isn't overloaded at all really, any more than it is in
list comprehensions. <- always means monadic bind. it is fully general
in 'do'. restricted to the list monad in list comprehensions, and
restricted to something like the exit monad you mention in pattern
guards. They are all consistent uses of (<-).

pattern guards have almost unanimous support for inclusion in haskell'.
so, even if a couple people on the comitee switched positions, pattern
guards would still most likely end up in. Since they are just syntatic
sugar, there cannot be an overriding technical reason they won't work,
and it is unlikely that many peoples aethetics of coding will change.


John Meacham - ⑆⑆john⑈

More information about the Haskell-prime mailing list