haskell - Add a monad to the middle of a transformer stack -


i'm trying "semilift" (exceptt error io foo) (exceptt error (statet bar io) baz).

i've tried lift, fmap lift, , fmap return, , none work; there standard idiom here?

> import control.monad.except > import control.monad.state > data error > data foo > data bar > data baz > x = undefined :: exceptt error io foo > y = undefined :: (exceptt error (statet bar io) baz) ->  > f = ??? -- i'm trying find.  > :t y (f x) y (f x) :: 

ignoring exceptt newtypes, have

io (either error foo) 

and want

statet bar io (either error foo) 

(i don't see want baz, i'm ignoring it.)

that lift. believe should able use

exceptt . lift . runexceptt 

as alec noted, can written using mapexceptt:

mapexceptt lift 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -