{-# options_haddock prune #-}
module Polysemy.Conc.Effect.Mask where
import Polysemy.Conc.Effect.Scoped (Scoped_, scoped_)
data RestoreMask :: Effect where
Restore :: m a -> RestoreMask m a
makeSem_ ''RestoreMask
restore ::
∀ r a .
Member RestoreMask r =>
Sem r a ->
Sem r a
newtype Restoration =
Restoration { Restoration -> forall a. IO a -> IO a
unRestoration :: ∀ a . IO a -> IO a }
type Mask =
Scoped_ RestoreMask
type UninterruptibleMask =
Scoped_ RestoreMask
mask ::
Member Mask r =>
InterpreterFor RestoreMask r
mask :: forall (r :: [(* -> *) -> * -> *]).
Member Mask r =>
InterpreterFor RestoreMask r
mask =
Sem (RestoreMask : r) a -> Sem r a
forall (effect :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *]).
Member (Scoped_ effect) r =>
InterpreterFor effect r
scoped_
uninterruptibleMask ::
Member UninterruptibleMask r =>
InterpreterFor RestoreMask r
uninterruptibleMask :: forall (r :: [(* -> *) -> * -> *]).
Member Mask r =>
InterpreterFor RestoreMask r
uninterruptibleMask =
Sem (RestoreMask : r) a -> Sem r a
forall (effect :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *]).
Member (Scoped_ effect) r =>
InterpreterFor effect r
scoped_