Home > Uncategorized > CHP vs CML, Forking and Picky Receivers
CHP vs CML, Forking and Picky Receivers  CHP is a Haskell
library that implements message-passing concurrency — and so is
CML, a Haskell implementation of the concurrency features of
Concurrent ML. Recently, someone asked on reddit what the
differences are between the CHP and CML libraries. So in this
post, I will perform a comparison by going through the API of
the CML Haskell package and seeing how to implement the same
functionality in CHP.  CML Events in CHP  CML is organised
around Event types. An Event represents a sort of future
synchronisation, that can be engaged in using the function sync
:: Event a -> IO a. CHP doesn’t have this distinction as such;
all events are monadic actions, and you engage in them when you
execute them in the CHP monad. So in effect, anything of type
Event a in CML is just CHP a in CHP. CML has a choose :: [Event
a] -> Event a function for choosing between such events, which
is identical to CHP’s function alt ::