I very much like Simon's proposal.
It's useful, clean, fits neatly into the syntax,
and does not cause any difficult implementation problems.
In other words, it fits all the requirements of good language design.

Tony Davie wrote:
 > Yes. I really like the fact that at last guards in comprehensions and those
 > in function defns have the same syntax. But shouldn't they have the same
 > semantics too? I would rather expect

 > f g l| x <- l = g x

 > or something like it, to be the map function.

It is the map function, but the map function of a different monad.

Actually, it might be useful (just guessing) to give the user the choice
which Monad (or MonadZero) is meant for the interpretation of guards,
or even to make the appropriate overloading, i.e. Tony's example
would become the overloaded map function of any monad.

--
Stefan Kahrs



Reply via email to