privileged-concurrency-0.3: Provides privilege separated versions of the concurrency primitives.

Portabilitynon-portable (concurrency)
Safe HaskellSafe-Infered




Privilege separated concurrency abstractions.


Privelege Seperated Concurrent Haskell

GHC's containers for communication between threads, such as MVar, allow any thread with access to a mutable unit to perform any operation on that unit. However, there are times when there needs to be guarantees about what can read or write to a particular location. For example, a thread which is intended to only produce values for a Chan should not be able to consume values from the same Chan. If instead the function were to receive a WriteOnlyChan, then the user of the producer function could rest assured that it would never consume values.

Another possible scenario is that you are writing a library that has some complicated interaction between threads, and exposing a bare Chan to the user of your library could break some invariants that you want to guarantee. Rather than providing a bare Chan, you can provide a ReadOnlyChan or WriteOnlyChan, therefore protecting your invariants.