polysemy-conc-0.4.0.0: Polysemy Effects for Concurrency
Safe HaskellNone
LanguageHaskell2010

Polysemy.Conc.Effect.Events

Description

 
Synopsis

Documentation

newtype EventToken token Source #

Marker for the Scoped token for Events.

Constructors

EventToken 

Fields

Instances

Instances details
Eq token => Eq (EventToken token) Source # 
Instance details

Defined in Polysemy.Conc.Effect.Events

Methods

(==) :: EventToken token -> EventToken token -> Bool #

(/=) :: EventToken token -> EventToken token -> Bool #

Show token => Show (EventToken token) Source # 
Instance details

Defined in Polysemy.Conc.Effect.Events

Methods

showsPrec :: Int -> EventToken token -> ShowS #

show :: EventToken token -> String #

showList :: [EventToken token] -> ShowS #

Generic (EventToken token) Source # 
Instance details

Defined in Polysemy.Conc.Effect.Events

Associated Types

type Rep (EventToken token) :: Type -> Type #

Methods

from :: EventToken token -> Rep (EventToken token) x #

to :: Rep (EventToken token) x -> EventToken token #

type Rep (EventToken token) Source # 
Instance details

Defined in Polysemy.Conc.Effect.Events

type Rep (EventToken token) = D1 ('MetaData "EventToken" "Polysemy.Conc.Effect.Events" "polysemy-conc-0.4.0.0-inplace" 'True) (C1 ('MetaCons "EventToken" 'PrefixI 'True) (S1 ('MetaSel ('Just "unEventToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 token)))

data Events (token :: Type) (e :: Type) :: Effect where Source #

An event publisher that can be consumed from multiple threads.

Constructors

Publish :: e -> Events token e m () 

Instances

Instances details
type DefiningModule Events Source # 
Instance details

Defined in Polysemy.Conc.Effect.Events

type DefiningModule Events = "Polysemy.Conc.Effect.Events"

publish :: forall e token r. Member (Events token e) r => e -> Sem r () Source #

Publish one event.

data Consume (e :: Type) :: Effect where Source #

Consume events emitted by Events.

Constructors

Consume :: Consume e m e 

Instances

Instances details
type DefiningModule Consume Source # 
Instance details

Defined in Polysemy.Conc.Effect.Events

type DefiningModule Consume = "Polysemy.Conc.Effect.Events"

consume :: forall e r. Member (Consume e) r => Sem r e Source #

Consume one event emitted by Events.

subscribe :: forall e token r. Member (Scoped (EventToken token) (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.