Skip to content

Add interruption type #19

@treeowl

Description

@treeowl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions