[Haskell-cafe] Re: Re: Re: monad subexpressions

Neil Mitchell ndmitchell at gmail.com
Fri Aug 3 17:15:36 EDT 2007


Hi

> > > do case x of
> > >          [] -> return 1
> > >          (y:ys) -> g y >>= \temp -> f temp
>
> > See the rule about always binding to the previous line of a do block.
> > This case then violates that.
>
> I assumed that the example was equivalent to :
>
> do case x of
>          [] -> return 1
>          (y:ys) -> do f (<- g y)
>
> Shouldn't the rule work then ?

If the do was inserted, then yes, this would work. Without it, it
doesn't. Perhaps this makes a restriction to not inside
case/let/lambda not that severe, since usually an additional do could
be inserted.

Thanks

Neil


More information about the Haskell-Cafe mailing list