[Haskell-cafe] runSubStateT

Christopher Done chrisdone at gmail.com
Tue Jan 27 22:14:09 UTC 2015

runSubStateT :: Monad m
             => (s -> s') -> (s' -> s) -> StateT s' m a -> StateT s m a
runSubStateT to from m =
  StateT (\s ->
            liftM (\(a,s') -> (a,from s'))
                  (runStateT m (to s)))

Anyone ever needed something like this? Does it already exist in some
form in the standard libraries?


More information about the Haskell-Cafe mailing list