On 12 Oct 2008, at 21:08, Andrew Coppin wrote:

I found that by using the brief and easily memorable construction "runIdentity $ runListT $ runStateT foo state" I can get at the result set for each action, and combine them. But nothing in hell seems to transform this from [((), MyState)] back into MyMonad ().

Well, State monad (and StateT transformer) doesn't work with STATE, they work with STATE CHANGES. So, instead of [((), MyState], you should have something like (MyState -> [((), MyState)]). And that can be transformed to MyMonad () quite easily:

Prelude Control.Monad.State Control.Monad.List Control.Monad.Identity> :t \f -> StateT $ ListT . Identity . f \f -> StateT $ ListT . Identity . f :: (s -> [(a, s)]) -> StateT s (ListT Identity) a

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to