Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Restart = Restart
- data Monitor (action :: Type) :: Effect where
- monitor :: forall action r a. Member (Monitor action) r => Sem r a -> Sem r a
- type ScopedMonitor (action :: Type) = Scoped_ (Monitor action)
- type RestartingMonitor = ScopedMonitor Restart
- data MonitorCheck r = MonitorCheck {
- interval :: NanoSeconds
- check :: MVar () -> Sem r ()
- hoistMonitorCheck :: (forall x. Sem r x -> Sem r' x) -> MonitorCheck r -> MonitorCheck r'
- withMonitor :: forall action r. Member (ScopedMonitor action) r => InterpreterFor (Monitor action) r
- restart :: Member (ScopedMonitor Restart) r => InterpreterFor (Monitor Restart) r
Documentation
Marker type for the restarting action for Monitor
.
Instances
data Monitor (action :: Type) :: Effect 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
.
monitor :: forall action r 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 RestartingMonitor = ScopedMonitor Restart Source #
data MonitorCheck r Source #
MonitorCheck | |
|
hoistMonitorCheck :: (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. Member (ScopedMonitor action) r => InterpreterFor (Monitor action) r Source #
Start a region that can contain monitor-intervention regions.
restart :: Member (ScopedMonitor Restart) r => InterpreterFor (Monitor Restart) r Source #
Variant of withMonitor
that uses the Restart
strategy.