If you want to use the main monad in a monad transformer, you can use lift:
lift :: (MonadTrans t, Monad m) => m a -> t m a
In this case, tthere is StateT MyState, and m- MyMonad. So for example:
foo :: StateT MyState MyMonad MyType
foo = do
modify $ \s -> s+1
lift $ doSomethingInMyMonad 42
Monad " " , MyMonad MyType ; : , . , StateT s m State s, , lift m StateT s m.
Monad Transformer Library (mtl), StateT, ReaderT .., , lift; , modify ask, - . ( - , StateT s (ReaderT r IO).)
, IO , IO :
liftIO :: (MonadIO m) => IO a -> m a
So liftIO (putStrLn "Hello, world!") IO, StateT Int IO, ContT r (WriterT [String] IO) ..
( foo , - .)