[Haskell-cafe] Re: monad subexpressions

david48 dav.vire+haskell at gmail.com
Fri Aug 3 15:26:22 EDT 2007


On 8/3/07, Neil Mitchell <ndmitchell at gmail.com> wrote:

This is how I understand it:

> Can you use (<-) outside of a do block?
> b >> f (<- a)

b >> do { ta <-a; f ta }
or
b >> a >>= \ta -> f ta

> What are the semantics of
> do b >> f (<- a)

do b >> a >>= \ta -> f ta

> Given:
>
> if (<- a) then f (<- b) else g (<- c)

a >>= \ta -> if (ta) then ( b >>= \tb -> f tb ) else ( c >>= \tc -> f tc )

> do let x = (<- a)
>     f x

No idea if that could be possible. or maybe :

do a >>= \ta -> let x = ta in f x


 _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list