Lifting a higher order function in Haskell
I'm trying to construct a function of type: liftSumthing :: ((a -> m b) -> m b) -> (a -> t m b) -> t m b where t is a monad transformer. Specifically, I'm interested in doing this: liftSumthingIO :: MonadIO m => ((a -> IO b) -> IO b) -> (a -> m b) -> m b I fiddled with some Haskell wizardry libs and but to no avail. How do I get it right, or maybe there is a ready solution somewhere which I did not find? This can't be done generically over all MonadIO instances because of the IO type in a negative position. There are some libraries on hackage that do this for specific instances ( monad-control