Hi

Suppose I have a transformer stack such as `StateT s IO a`

and I need to use this with any transformer stack which wraps this one, so things such as `ExceptT e (StateT s IO a)`

, `WriterT w (StateT s IO a)`

, or `ExceptT e (WriterT w (StateT s IO a)`

. In this case `lift`

wouldn’t do, as sometimes I would need `lift`

and others `lift.lift`

, etc. Would the following function be the right way to do this ?

```
transformersToMtlState :: (Monad m, MonadState s t, MonadBase m t) => StateT s m a -> t a
transformersToMtlState m = do
currentState <- get
(a, newState) <- liftBase $ runStateT m currentState
put newState
return a
```

Thanks,

Miguel Negrão