If I have a function f :: State Int (), is it possible to use it within another function g :: StateT Int IO ()? Nesting it with f = do { some
f :: State Int ()
g :: StateT Int IO ()
f = do { some
Yes, this operation is usually called "hoisting". For the State monad, it could be defined as
hoistState :: Monad m => State s a -> StateT s m a hoistState = state . runState
Unfortunately, it is not defined in the Control.Monad.State module.
Control.Monad.State