Events in Haskell, and how to implement them

  • Authors:
  • George Russell

  • Affiliations:
  • Univ. Bremen, Brenen, Germany

  • Venue:
  • Proceedings of the sixth ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

Abstract

We describe a new and simpler implementation in Haskell of CML'sevents, which encode reactions by a thread to combinations ofmessages from other threads. We add a new type of Guarded Events,by which recipients can filter messages with conditions on theirvalue known as Guards. We implement guarded channels. The guardtype and the indexing algorithm are not part of the channeldefinition, so that the user can trade off what guards are requiredagainst the cost of indexing. As an example we sketch theencapsulation of a graphical user interface toolkit. This can bedone concisely not only because of guarded events, but also becausewe construct events monadically. Monadic events are especiallyhelpful for representing concurrent processes which transformthemselves in reaction to external communications.