Are pattern guards obsolete?

Yitzchak Gale gale at
Wed Dec 13 06:09:59 EST 2006

Donald Bruce Stewart <dons at ...> wrote:
>>> The joy of pattern guards
>>> reveals once you have more conditions.

I wrote:
>> Of course, this is not really the joy of
>> pattern guards. It is the joy of monads,
>> with perhaps a few character strokes
>> saved by a confusing overloading of (<-).

Philippa Cowderoy wrote:
> I don't find it any more confusing than the overloading
> of ->.

You mean that it is used both for lambda abstractions
and for functional dependencies? True, but those
are so different that there is no confusion.

> Note that it's not (<-) - it's not an operator.

Right, it is syntactic sugar for a monad.

But this syntax is already used in two places:
do notation and list comprehensions. The semantics
are exactly the same in both existing uses.

The semantics of the proposed new use in pattern
guards is quite different, as was discussed in the
previous thread. Yet close enough to be confused.

There seems to be a consensus that pattern guards
are here to stay. So I am proposing to mitigate the
damage somewhat by using a different but similar
symbol . That matches the different but similar
semantics. I mentioned (<<-) as one possibility.


More information about the Haskell-prime mailing list