Krasimir Angelov wrote:

ered on top of ST and the stToIO is
the lifting function. What does 'automatically be
lifted' mean?

Krasimir


For example with the state monad you can define:

instance (MonadState st m,MonadT t m) => MonadState st (t m) where
  update = up . update
  setState = up . setState
  getState = up $ getState

This makes any monad transformer applied to the StateMonad transformer
an instance of the StateMonadTransformer. When you use getState, you
do not have to prefix the lifting, the type checker unwinds the instance, and
for each transformer it removes adds a lift.


If is only possible to define the above for some monad-transformers. In other
cases the lifts must be specific to the monad-transformer being lifted through,
in which case you would define:


instance Monad m => MonadTransX (MonadState m) where
   ...

This would be for lifting functions of MonadTransX through MonadState
specifically.

   Keean.



_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to