uni-events-2.2.2.1: uni events
Safe HaskellNone
LanguageHaskell98

Events.GuardedEvents

Description

In GuardedEvents we extend the notion of PrimEvents to allow Guarded Events, which can be guarded with the new (|>) operator. GuardedChannels will implement guarded events on channels, which will hopefully be the only guarded event we will ever need.

Synopsis

Documentation

data Guard guard => GuardedEvent guard a Source #

A GuardedEvent guard a represents a source of values of type a, which may be selected from according to guards of type guard.

Constructors

GuardedEvent !(guard -> Event a) !guard 

Instances

Instances details
Guard guard => HasEvent (GuardedEvent guard) Source # 
Instance details

Defined in Events.GuardedEvents

Methods

toEvent :: GuardedEvent guard a -> Event a Source #

Guard guard => HasGuard (GuardedEvent guard) guard Source # 
Instance details

Defined in Events.GuardedEvents

Methods

(|>) :: GuardedEvent guard a -> guard -> GuardedEvent guard a Source #

class Guard guard => HasGuard eventType guard where Source #

Methods

(|>) :: eventType a -> guard -> eventType a infixr 2 Source #

Instances

Instances details
Guard guard => HasGuard (GuardedEvent guard) guard Source # 
Instance details

Defined in Events.GuardedEvents

Methods

(|>) :: GuardedEvent guard a -> guard -> GuardedEvent guard a Source #

class Guard guard where Source #

A Guard represents some condition on a value which we impose on a channel, selecting those values we are interested in.

Methods

nullGuard :: guard Source #

this should be the guard that always matches

andGuard :: guard -> guard -> guard Source #

this should be the guard that corresponds to the conjunction of the two given guards.

Instances

Instances details
Guard () Source # 
Instance details

Defined in Events.NullGuard

Methods

nullGuard :: () Source #

andGuard :: () -> () -> () Source #

Ord key => Guard (EqMatch key) Source # 
Instance details

Defined in Events.EqGuard

Methods

nullGuard :: EqMatch key Source #

andGuard :: EqMatch key -> EqMatch key -> EqMatch key Source #

class HasListen chan where Source #

Class of those channels which have guarded events.

Methods

listen :: Guard guard => chan guard a -> GuardedEvent guard a Source #

Instances

Instances details
HasListen GuardedChannel Source # 
Instance details

Defined in Events.GuardedChannels

Methods

listen :: Guard guard => GuardedChannel guard a -> GuardedEvent guard a Source #