Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- class MonadTransControl t => MonadTransControlIdentity t where
- liftWithIdentity :: Monad m => ((forall x. t m x -> m x) -> m a) -> t m a
- defaultLiftWithIdentity :: (Monad m, MonadTransControl t) => ((forall x. StT t x ~ x => t m x -> m x) -> m a) -> t m a
- class MonadBaseControl b m => MonadBaseControlIdentity b m | m -> b where
- liftBaseWithIdentity :: ((forall x. m x -> b x) -> b a) -> m a
- defaultLiftBaseWithIdentity :: (MonadBaseControlIdentity b m, MonadTransControlIdentity t) => ((forall x. t m x -> b x) -> b a) -> t m a
MonadTransControlIdentity
class MonadTransControl t => MonadTransControlIdentity t where Source #
The MonadTransControlIdentity
type class is a stronger version of
MonadTransControl
:
MonadTransControl
instances are aware of the monadic state of the
transformer and allow to save and restore this state.
MonadTransControlIdentity
instances on the other hand exist only for
exactly those transformers, that don't have any monadic state.
So for any instance of this class this should hold:
forall a. StT
t a ~ a
This can't be given as a constraint to the class due to limitations
regarding the TypeFamilies
extension.
liftWithIdentity :: Monad m => ((forall x. t m x -> m x) -> m a) -> t m a Source #
Instances
MonadTransControlIdentity (ReaderT r) Source # | |
Defined in Control.Monad.Trans.Control.Identity | |
MonadTransControlIdentity (IdentityT :: (Type -> Type) -> Type -> Type) Source # | |
Defined in Control.Monad.Trans.Control.Identity |
MonadTransControlIdentity
instances can easily be created for
monad transformers, because of the superclass MonadTransControl
:
newtype ExampleT = ... deriving (Monad
,MonadTrans
) instanceMonadTransControl
ExampleT where ... instanceMonadTransControlIdentity
ExampleT whereliftWithIdentity
=defaultLiftWithIdentity
defaultLiftWithIdentity :: (Monad m, MonadTransControl t) => ((forall x. StT t x ~ x => t m x -> m x) -> m a) -> t m a Source #
MonadBaseControlIdentity
Regarding the IO
base monad this can be seen as an alternative
way to implement MonadUnliftIO
.
class MonadBaseControl b m => MonadBaseControlIdentity b m | m -> b where Source #
The MonadBaseControlIdentity
type class is a stronger version of
MonadBaseControl
.
Just like MonadTransControlIdentity
instances of
MonadBaseControlIdentity
hold no monadic state:
forall a. StM
m a ~ a
liftBaseWithIdentity :: ((forall x. m x -> b x) -> b a) -> m a Source #
Instances
MonadBaseControl b b => MonadBaseControlIdentity b b Source # | |
Defined in Control.Monad.Trans.Control.Identity liftBaseWithIdentity :: ((forall x. b x -> b x) -> b a) -> b a Source # | |
MonadBaseControlIdentity b m => MonadBaseControlIdentity b (ReaderT r m) Source # | |
Defined in Control.Monad.Trans.Control.Identity liftBaseWithIdentity :: ((forall x. ReaderT r m x -> b x) -> b a) -> ReaderT r m a Source # | |
MonadBaseControlIdentity b m => MonadBaseControlIdentity b (IdentityT m) Source # | |
Defined in Control.Monad.Trans.Control.Identity liftBaseWithIdentity :: ((forall x. IdentityT m x -> b x) -> b a) -> IdentityT m a Source # |
Just like MonadTransControlIdentity
, MonadBaseControl
instances
can easily be created for monad transformers:
instanceMonadTransControlIdentity
ExampleT whereliftBaseWithIdentity
=defaultLiftBaseWithIdentity
defaultLiftBaseWithIdentity :: (MonadBaseControlIdentity b m, MonadTransControlIdentity t) => ((forall x. t m x -> b x) -> b a) -> t m a Source #