Hello!

On Fri, Jan 22, 1999 at 01:14:43AM +1100, Jason Stokes wrote:
> Hi, this is kind of a novice question, but I hope it's OK to ask it here: what 
> precisely is the semantics of a generator?  The Haskell report mentions them, 
> but doesn't explain their semantics.

See section 3.11, "Translation".

> I understand how to use them in list 
> comprehensions, but I don't understand how generators can be applied to 
> arbitrary monads.  What does a generator applied to an arbitrary monad in a 
> monad comprehension do?  How can they be used?

It seems that in most cases except lists, the do notation seems
to be more natural than comprehensions, as comprehensions got
(re)restricted to lists (instead of monads in general) in the
Haskell 98 standard.

Perhaps with the Maybe monad or the parser monad (from the monadic
parser combinator library), one could imagine good uses of comprehensions.

Regards, Felix.



Reply via email to