Events in Haskell, and how to implement them

Authors
Citation
G. Russell, Events in Haskell, and how to implement them, ACM SIGPL N, 36(10), 2001, pp. 157-168
Citations number
25
Categorie Soggetti
Computer Science & Engineering
Journal title
ACM SIGPLAN NOTICES
ISSN journal
15232867 → ACNP
Volume
36
Issue
10
Year of publication
2001
Pages
157 - 168
Database
ISI
SICI code
1523-2867(200110)36:10<157:EIHAHT>2.0.ZU;2-B
Abstract
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.