MonadBase and MonadBaseControl instances for transformers reach all the way to the bottom of the stack. Sometimes that's too far. We should offer (modulo naming)
newtype BaseT m a = BaseT
{ runBaseT :: m a }
deriving (Functor, Applicative, Monad, Generic, Generic1)
deriving instance Show (m a) => Show (BaseT m a)
-- etc.
instance MonadTrans BaseT where
lift = BaseT
instance MonadBase m (BaseT m) where
liftBase = BaseT
instance MonadBaseControl m (BaseT m) where
type StM (BaseT m) a = a
liftBaseWith f = BaseT $ f runBaseT
restoreM = BaseT . return
Now StateT s (BaseT (ReaderT e m)) has base monad ReaderT e m.
MonadBaseandMonadBaseControlinstances for transformers reach all the way to the bottom of the stack. Sometimes that's too far. We should offer (modulo naming)Now
StateT s (BaseT (ReaderT e m))has base monadReaderT e m.