Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype EventResource resource = EventResource {
- unEventToken :: resource
- data Events (resource :: Type) (e :: Type) :: Effect where
- publish :: forall e resource r. Member (Events resource e) r => e -> Sem r ()
- data Consume (e :: Type) :: Effect where
- consume :: forall e r. Member (Consume e) r => Sem r e
- subscribe :: forall e resource r. Member (Scoped (EventResource resource) (Consume e)) r => InterpreterFor (Consume e) r
Documentation
newtype EventResource resource Source #
EventResource | |
|
Instances
data Events (resource :: Type) (e :: Type) :: Effect where Source #
An event publisher that can be consumed from multiple threads.
Instances
type DefiningModule Events Source # | |
Defined in Polysemy.Conc.Effect.Events |
publish :: forall e resource r. Member (Events resource e) r => e -> Sem r () Source #
Publish one event.
data Consume (e :: Type) :: Effect where Source #
Consume events emitted by Events
.
Instances
type DefiningModule Consume Source # | |
Defined in Polysemy.Conc.Effect.Events |
subscribe :: forall e resource r. Member (Scoped (EventResource resource) (Consume e)) r => InterpreterFor (Consume e) r Source #
Create a new scope for Events
, causing the nested program to get its own copy of the event stream.
To be used with interpretEventsChan
.