We describe a new and simpler implementation in Haskell of CML's events, wh
ich encode reactions by a thread to combinations of messages from other thr
eads. We add a new type of Guarded Events, by which recipients can filter m
essages with conditions on their value known as Guards. We implement guarde
d channels. The guard type and the indexing algorithm are not part of the c
hannel definition, so that the user can trade off what guards are required
against the cost of indexing.
As an example we sketch the encapsulation of a graphical user interface too
lkit. This can be done concisely not only because of guarded events, but al
so because we construct events monadically. Monadic events are especially h
elpful for representing concurrent processes which transform themselves in
reaction to external communications.