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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -