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
- newtype MonitorResource a = MonitorResource {
- unMonitorResource :: a
- type ScopedMonitor (resource :: Type) (action :: Type) = Scoped (MonitorResource resource) (Monitor action)
- type RestartingMonitor (resource :: Type) = ScopedMonitor resource Restart
- data MonitorCheck r = MonitorCheck {
- interval :: NanoSeconds
- check :: MVar () -> Sem r ()
- withMonitor :: forall resource action r. Member (ScopedMonitor resource action) r => InterpreterFor (Monitor action) r
- restart :: forall resource r. Member (ScopedMonitor resource 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
.
Instances
type DefiningModule Monitor Source # | |
Defined in Polysemy.Conc.Effect.Monitor |
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.
newtype MonitorResource a Source #
type ScopedMonitor (resource :: Type) (action :: Type) = Scoped (MonitorResource resource) (Monitor action) Source #
type RestartingMonitor (resource :: Type) = ScopedMonitor resource Restart Source #
data MonitorCheck r Source #
MonitorCheck | |
|
withMonitor :: forall resource action r. Member (ScopedMonitor resource action) r => InterpreterFor (Monitor action) r Source #
Start a region that can contain monitor-intervention regions.
restart :: forall resource r. Member (ScopedMonitor resource Restart) r => InterpreterFor (Monitor Restart) r Source #
Variant of withMonitor
that uses the Restart
strategy.