Kent Logo

CHP: Communicating Haskell Processes

Process-Oriented Concurrency for Haskell


CHP and CHP-Plus are Haskell libraries featuring a concurrency model inspired by CSP (Communicating Sequential Processes, hence the name), and all its various renderings in occam-pi, JCSP, C++CSP2, etc. The concurrency is built around encapsulated processes, without any shared data, that interact via barriers and one-way typed synchronous channels. The tutorial is probably the best place to start.


CHP has both API documentation (which can be generated by haddock from the source) and a tutorial. There is also a CHP blog containing examples of using the library.


CHP 2.1.0 and CHP-Plus 1.2.0 are available on Hackage.


CHP requires GHC 6.10. CHP depends on a widely available set of libraries, most of which are in the Haskell Platform.


A paper on CHP was presented at CPA 2008. You can also find more information on the author and the research group at Kent.


19th June 2008: CHP v1.0.0 released.

21st June 2008: CHP v1.0.1 released. This version corrects the tracing behaviour and adjusts some of the documentation.

26th June 2008: CHP v1.0.2 released. This version fixes the CHP monad to obey the monad laws, adds several useful new functions (pipeline, cycle, writeChannelStrict, checkForPoison), corrects some documentation, adds a new module with an instance of Arrow for process pipelines, and fixes the console channels to shut down properly.

6th August 2008: CHP v1.1.0 released. This version adds conjunction of choice (every and <&>), fixes a bug in the extended read semantics, added an EnrolledBarrier synonym, a new <|*|> operator that discards output, added a strict map' process, fixed the behaviour of the extId process and improved some parts of the documentation.

18th January 2009: CHP v1.1.1 released. This version adds Eq instances for channels and channel-ends, a new valueStore helper process, added reduce channels (many-to-one, opposite of broadcast channels) and made the necessary fixes to get the library to compile with GHC 6.10 (and still compile on GHC 6.8).

14th March 2009: CHP v1.2.0 released. This version adds an implementation of Adam Sampson's clocks and adds labelling support to broadcast and reduce channels. It adds a few new common processes, fixes a poisoning bug in valueStore and valueStore', and generalises and specialises a few types for common processes. It also allows custom phase incrementation for phased barriers, and adds a module of "actions" that allow for better wrapping up of channel-ends.

7th September 2009: CHP v1.3.0 released. This version changes the traces to be parameterised by the event labels (previously it was fixed to be Unique). This allows better manipulation of the traces later on, for example for automated analysis and visualisation. The embedCHP helper functions were also added to make working with IO callbacks easier. Instances of Applicative and Functor for CHP were also added.

10th September 2009: Uploaded a new version of the tutorial, correcting several errors (thanks to Doug Burke for pointing them out!).

15th September 2009: CHP v1.3.1 released. This version fixes some build/dependency problems with version 1.3.0.

23rd September 2009: CHP v1.3.2 released. This version adds two useful functions: furtherEnroll and arrStrict, and contains some optimisations.

1st October 2009: CHP v1.4.0 released. This version adds more wiring functions, an extWriteChannel' function, as well as Eq instances for the broadcast and reduce channels. It also adds a sameChannel function for checking if a reading-end refers to the same channel as a writing end. A new Test module has also been added that supports QuickCheck and HUnit tests on CHP programs, and finally a space leak was removed and some efficiency gains made.

30th October 2009: CHP v1.5.0 released. The Test module has been greatly improved with better support for both QuickCheck and HUnit tests. This version refactors some of the modules related to channels, and reworks tracing of channels to support recording the value passed down a channel in a trace. The documentation has been improved in several places, and the library now compiles with GHC 6.12. Broadcast and reduce channels have been optimised.

10th November 2009: CHP v1.5.1 released. This fixes a bug in runParallel and runParallel_, which were wrongly deadlocking when given an empty list of processes to run (since 1.5.0). It also adds two new helper functions: runParMapM and runParMapM_.

13th November 2009: CHP v1.6.0 released. This primarily adds behaviours, a new kind of process combinator. It also fixes the semantics for broadcast and reduce channels when no-one is enrolled on the reading and writing end respectively, and adds a Functor instance for ProcessPipeline, as well as generalising the type of the primitive stop process.

24th November 2009: CHP v1.7.0 released. This adds the Connect module, which generalises the process wiring functions previously found in Utils. It also refactors the barrier creation functions (to be like the recently refactored channel creation functions) and adds various helper functions.

2nd December 2009: CHP v1.7.1 released. This fixes the version requirement on the parallel package, which previously had no upper bound, but now needs one.

6th December 2009: CHP v1.8.0 released. This adds a new Connect.TwoDim module with functions for wiring together grids of processes with four and eight-way connectivity. Several other small functions have been added, and the type of the connect function has been generalised to allow return types other than unit.

11th January 2010: CHP v2.0.0 and CHP-Plus v1.0.0 released. This splits the CHP package into a core part (CHP) and a set of higher-level constructs on top of it (CHP-Plus). The main other change was that the Utils module has now been removed in favour of using the Connect module from the CHP-Plus library.

5th February 2010: Uploaded a new version of the tutorial to reflect the latest changes to CHP (thanks to Andy Gimblett for spotting these).

1st March 2010: CHP-Plus v1.0.1 released. This fixes some build problems caused by the changes in QuickCheck- No functionality or API has been changed.

22nd March 2010: CHP v2.1.0 released. This includes a large rewrite of CHP's core, which should be much faster. Priority for channels and barriers was also added.

22nd March 2010: CHP-Plus v1.1.0 released. This adds some instances for Connectable with shared channels (and supports the use of CHP 2.1.0).

28th March 2010: CHP-Plus v1.2.0 released. This fixes a problem with ConnectableExtra that prevented building on GHC 6.10, and adds a new Control.Concurrent.CHP.Composed module with a Composed monad for more flexible wiring of systems.

29th March 2010: CHP v2.1.0.1 released. This fixes a bug whereby poison occurring in a claim block would not release the claim on the channel.

This page copyright Neil Brown, University of Kent, 2008--2010.