[Haskell-cafe] transformers problem: Could not deduce MonadTrans (StateT s) ??

Anton Kholomiov anton.kholomiov at gmail.com
Sat Jun 23 18:22:13 CEST 2012


Why this function doesn't compile?

phi :: Monad m => StateT s m ()
phi = lift $ return ()

I get (ghc-7.4.1)

    Could not deduce (MonadTrans (StateT s))
      arising from a use of `lift'
    from the context (Monad m)
      bound by the type signature for phi :: Monad m => StateT s m ()
      at FSMt.hs:28:1-22
    Possible fix:
      add (MonadTrans (StateT s)) to the context of
        the type signature for phi :: Monad m => StateT s m ()
      or add an instance declaration for (MonadTrans (StateT s))
    In the expression: lift
    In the expression: lift $ return ()
    In an equation for `phi': phi = lift $ return ()
Failed, modules loaded: none.


Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120623/a0cfcb9e/attachment.htm>


More information about the Haskell-Cafe mailing list