[Haskell-cafe] questions on lazy pattern, StateT monad

Wolfgang Jeltsch wolfgang at jeltsch.net
Thu Nov 24 15:34:11 EST 2005

Am Donnerstag, 24. November 2005 21:19 schrieben Sie:
> [...]

> Here I want to correct a statement I made previously about:
>   mplus m1 m2       = do  ...
>                         ~(a,s') <- lift (mplus m1' m2')
> In one of my emails to the thread I mentioned m1/m2 and m1'/m2' could
> be different Monads so mplus works differently (so that this is not
> exactly a recusrive data structure), but even so the lazy pattern
> works. The problem is when m1/m2 and m1'/m2' are of the same Monad
> type, then the problem of recursive definition comes up and this is
> the place lazy patterns are particularly useful.

They cannot belong to the same monad.  If s is the state type and m1' and m2' 
belong to the monad m then m1 and m2 belong to the monad StateT s m.

> Thanks,
> Fan

Best wishes,

More information about the Haskell-Cafe mailing list