polysemy-conc-0.14.1.1: Polysemy effects for concurrency
Safe HaskellNone
LanguageGHC2021

Polysemy.Conc.Effect.Monitor

Description

 
Synopsis

Documentation

data Restart Source #

Marker type for the restarting action for Monitor.

Constructors

Restart 

Instances

Instances details
Show Restart Source # 
Instance details

Defined in Polysemy.Conc.Effect.Monitor

Eq Restart Source # 
Instance details

Defined in Polysemy.Conc.Effect.Monitor

Methods

(==) :: Restart -> Restart -> Bool #

(/=) :: Restart -> Restart -> Bool #

data Monitor action (a :: Type -> Type) b where Source #

Mark a region as being subject to intervention by a monitoring program. This can mean that a thread is repeatedly checking a condition and cancelling this region when it is unmet. A use case could be checking whether a remote service is available, or whether the system was suspended and resumed. This should be used in a Scoped_ context, like withMonitor.

Constructors

Monitor :: forall (a :: Type -> Type) b action. a b -> Monitor action a b 

monitor :: forall action (r :: EffectRow) a. Member (Monitor action) r => Sem r a -> Sem r a Source #

Mark a region as being subject to intervention by a monitoring program.

type ScopedMonitor action = Scoped_ (Monitor action) Source #

Convenience alias for a Scoped_ Monitor.

type RestartingMonitor = ScopedMonitor Restart Source #

Monitor specialized to the Restart action.

data MonitorCheck (r :: EffectRow) Source #

Resources for a Scoped_ Monitor.

Constructors

MonitorCheck 

Fields

hoistMonitorCheck :: forall (r :: EffectRow) (r' :: EffectRow). (forall x. Sem r x -> Sem r' x) -> MonitorCheck r -> MonitorCheck r' Source #

Transform the stack of the check in a MonitorCheck.

withMonitor :: forall action (r :: EffectRow). Member (ScopedMonitor action) r => InterpreterFor (Monitor action) r Source #

Start a region that can contain monitor-intervention regions.

restart :: forall (r :: EffectRow). Member (ScopedMonitor Restart) r => InterpreterFor (Monitor Restart) r Source #

Variant of withMonitor that uses the Restart strategy.