Christopher Milton cmiltonperl at
Wed Dec 31 17:42:43 EST 2003


I'm no expert, but does it help to start from withStateT?

> withStateT :: (s -> s) -> StateT s m a -> StateT s m a
> withStateT f m = StateT $ runStateT m . f

There are some notes about computations and lifting
state transformers in

Modular Denotational Semantics for Compiler Construction
Sheng Liang, Paul Hudak

Monad Transformers and Modular Interpreters
Sheng Liang, Paul Hudak, Mark Jones

Don't mind me: I just couldn't control the vestiges of
librarianship lurking in my dark, lost soul...

Dobrego Nowego Roku!

Chris Milton (no, not MLton:-)

--- Mark Carroll <mark at> wrote:
> Omitting the typeclass bit, I'm trying to write something like
> (s1 -> s2) -> StateT s1 m () -> StateT s2 m a -> StateT s1 m a
> That is, it sequences two StateT computations, providing a way to
> translate from the first's state to the second to keep the chain
> going.
> I can easily write something for when s1 and s2 are the same, and my
> understanding of much of Control.Monad.* remains tenuous at best, but if
> it's easy for anyone to provide me with some tips, then I thought I should
> mention that it'd certainly be helpful.
> And Happy New Year, everyone!
> -- Mark
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at

More information about the Haskell-Cafe mailing list