Haskell: Automatic lifting to the closest transformer in a monad stack