Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module provides the core abstractions that represent managers for queueable events.
Synopsis
- class EQueue eq where
- registerSemi :: (MonadIO m, Semigroup b) => eq a -> (b -> a) -> m (b -> IO (), IO ())
- registerQueued :: MonadIO m => eq a -> m (a -> IO (), IO ())
- class EQueueW eq where
- type WaitPolicy eq :: *
- waitEQ :: MonadIO m => eq a -> WaitPolicy eq -> m [a]
Documentation
class EQueue eq where Source #
An EQueue is a way of managing edge and level triggered events. The choice of EQueue implementation allows late binding of the policy by which the application processes events.
registerSemi :: (MonadIO m, Semigroup b) => eq a -> (b -> a) -> m (b -> IO (), IO ()) Source #
Registers a level triggered event. These are the events that accumulate a combined change or resulting state. Returns a function to enqueue updates and unregister this event.
registerQueued :: MonadIO m => eq a -> m (a -> IO (), IO ()) Source #
Registers an edge triggered event. Returns a function to enqueue updates and unregister this event.
Instances
class EQueueW eq where Source #
An EQueueW is the interface for waiting on events in a queue.
type WaitPolicy eq :: * Source #
The WaitPolicy allows control per-call of waitEQ as to which policy is followed. For example, if it should return immediately if there are no events to dequeue or if it should wait for at least one event to be available.
waitEQ :: MonadIO m => eq a -> WaitPolicy eq -> m [a] Source #
The dequeue operation, collecting some set of available events, depending on the particular policy the given EQueue impliments.
Instances
EQueueW STMEQueue Source # | |
Defined in Control.Concurrent.EQueue.STMEQueue type WaitPolicy STMEQueue :: Type Source # | |
EQueueW TQueueEQueue Source # | |
Defined in Control.Concurrent.EQueue.Simple type WaitPolicy TQueueEQueue :: Type Source # waitEQ :: MonadIO m => TQueueEQueue a -> WaitPolicy TQueueEQueue -> m [a] Source # | |
EQueueW TChanEQueue Source # | |
Defined in Control.Concurrent.EQueue.Simple type WaitPolicy TChanEQueue :: Type Source # waitEQ :: MonadIO m => TChanEQueue a -> WaitPolicy TChanEQueue -> m [a] Source # | |
EQueueW ChanEQueue Source # | |
Defined in Control.Concurrent.EQueue.Simple type WaitPolicy ChanEQueue :: Type Source # waitEQ :: MonadIO m => ChanEQueue a -> WaitPolicy ChanEQueue -> m [a] Source # |