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

Neil Mitchell ndmitchell at gmail.com
Fri Aug 3 17:00:01 EDT 2007


Hi

> if you write :
>
> let x = (<-a):x
>
> is it possible that is desugars into :
>
> temp <-a
> let x = temp:x
>
> that would'nt work ?

That would work, since 'a' doesn't refer to 'x'. I can't think of a
real example where it becomes an issue, but the scope within 'a' has
changed.

> Also :
>
> > do case x of
> >          [] -> return 1
> >          (y:ys) -> f (<- g y)
>
> Is it not possible that is desugars to
>
> 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.

Thanks

Neil


More information about the Haskell-Cafe mailing list