in-other-words-0.2.0.0: A higher-order effect system where the sky's the limit
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Type.Mask

Synopsis

Effects

data Mask :: Effect where Source #

An effect for masking asynchronous exceptions.

Mask is typically used as a primitive effect. If you define a Carrier that relies on a novel non-trivial monad transformer t, then you need to make a ThreadsEff t Mask instance (if possible). threadMaskViaClass can help you with that.

The following threading constraints accept Mask:

Constructors

Mask :: MaskMode -> ((forall x. m x -> m x) -> m a) -> Mask m a 

Instances

Instances details
ThreadsEff (ExceptT e) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (ExceptT e m) a -> ExceptT e m a Source #

Monoid s => ThreadsEff (WriterT s) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (WriterT s m) a -> WriterT s m a Source #

ThreadsEff (StateT s) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (StateT s m) a -> StateT s m a Source #

ThreadsEff (ReaderT i) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (ReaderT i m) a -> ReaderT i m a Source #

ThreadsEff (StateT s) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (StateT s m) a -> StateT s m a Source #

Monoid s => ThreadsEff (WriterT s) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (WriterT s m) a -> WriterT s m a Source #

Monoid s => ThreadsEff (WriterT s) Mask Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

threadEff :: Monad m => (forall x. Mask m x -> m x) -> Mask (WriterT s m) a -> WriterT s m a Source #

Monad m => MonadThrow (ViaAlg s Mask m) Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

throwM :: Exception e => e -> ViaAlg s Mask m a #

Monad m => MonadCatch (ViaAlg s Mask m) Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

catch :: Exception e => ViaAlg s Mask m a -> (e -> ViaAlg s Mask m a) -> ViaAlg s Mask m a #

(Reifies s (ReifiedEffAlgebra Mask m), Monad m) => MonadMask (ViaAlg s Mask m) Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

mask :: ((forall a. ViaAlg s Mask m a -> ViaAlg s Mask m a) -> ViaAlg s Mask m b) -> ViaAlg s Mask m b #

uninterruptibleMask :: ((forall a. ViaAlg s Mask m a -> ViaAlg s Mask m a) -> ViaAlg s Mask m b) -> ViaAlg s Mask m b #

generalBracket :: ViaAlg s Mask m a -> (a -> ExitCase b -> ViaAlg s Mask m c) -> (a -> ViaAlg s Mask m b) -> ViaAlg s Mask m (b, c) #

Threading utilities

threadMaskViaClass :: forall t m a. Monad m => (RepresentationalT t, forall b. MonadMask b => MonadMask (t b)) => (forall x. Mask m x -> m x) -> Mask (t m) a -> t m a Source #

A valid definition of threadEff for a ThreadsEff t Mask instance, given that t lifts MonadMask.

BEWARE: threadMaskViaClass is only safe if the implementation of mask and uninterruptibleMask for t m only makes use of mask and uninterruptibleMask for m, and no other methods of MonadThrow, MonadCatch, and MonadMask.