[Haskell-cafe] Re: Explaining monads

Dan Piponi dpiponi at gmail.com
Mon Aug 13 19:24:58 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

instance Monad M where
    return a = M a
    ~(M a) >>= f = f a

Or is that cheating?
--
Dan


More information about the Haskell-Cafe mailing list