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

Wolfgang Jeltsch wolfgang at jeltsch.net
Thu Nov 24 16:00:29 EST 2005

Am Donnerstag, 24. November 2005 21:52 schrieb Fan Wu:
> > 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.
> I know it looks insane, I'm just trying to make a recursive case of
> it: technically it's still possible to have a StateT monad as the m in
> "StateT s m" right?

Yes, but this StateT type application cannot be equal to the outer StateT type 
application because this would result in an infinite type which Haskell 
doesn't support. Example:

	StateT Int (StateT Int (StateT Int ...))

> Thanks,
> Fan

Best wishes,

More information about the Haskell-Cafe mailing list