Concurrent Haskell
| Concurrent Haskell | |
|---|---|
| Original author(s) | Simon Peyton Jones Andrew D. Gordon Sigbjorn Finne |
| Developer(s) | The Glasgow Haskell Team |
| Initial release | 1 January 1996 |
| Stable release | GHC 9.10.1
/ 10 May 2024 |
| Repository | downloads |
| Written in | Haskell |
| Operating system | Linux, FreeBSD, macOS, Windows 2000 |
| Platform | AArch64, x86-64; Glasgow Haskell Compiler (GHC) |
| Included with | Glasgow Haskell Compiler |
| Available in | English |
| Type | library |
| License | BSD 3-clause (new) |
| Website | downloads |
Concurrent Haskell (also Control.Concurrent, or Concurrent and Parallel Haskell) is an extension to the functional programming language Haskell, which adds explicit primitive data types for concurrency. It was first added to Haskell 98, and has since become a library named Control.Concurrent included as part of the Glasgow Haskell Compiler.
Its two main underlying concepts are:
- A primitive data type
MVar αimplementing a bounded/single-place asynchronous channel, which is either empty or holds a value of typeα. - The ability to spawn a concurrent thread via the
forkIOprimitive.
Built on this is a set of useful concurrency and synchronizing abstractions such as unbounded channels, semaphores and sample variables.
Haskell threads have very low overhead: creating, context-switching, and scheduling are all internal to the Haskell runtime system. These Haskell-level threads are mapped onto a configurable number of operating system (OS) level threads, usually one per processor core.