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.
- data Guard guard => GuardedEvent guard a = GuardedEvent !(guard -> Event a) !guard
- class Guard guard => HasGuard eventType guard where
- (|>) :: eventType a -> guard -> eventType a
- class Guard guard where
- class HasListen chan where
A GuardedEvent guard a represents a source of values of type a, which may be selected from according to guards of type guard.
A Guard represents some condition on a value which we impose on a channel, selecting those values we are interested in.
this should be the guard that always matches
this should be the guard that corresponds to the conjunction of the two given guards.