[Haskell-cafe] Re: Explaining monads

Arie Peterson ariep at xs4all.nl
Mon Aug 13 19:46:29 EDT 2007


On 8/13/07, David Roundy <droundy at darcs.net> wrote:

| Try executing:
|
|   do { x <- return 2; undefined; return (x*x); }
|
| in any monad you like

It's not just the identity monad:

Prelude> :m +Control.Monad.State
Prelude Control.Monad.State> flip evalState () $ do { x <- return 2;
undefined; return (x*x); }
4


Regards,

Arie



More information about the Haskell-Cafe mailing list