|Maintainer||Luke Palmer <email@example.com>|
Functional concurrency with unambiguous choice. The primary
export of this module is the
unamb function, which has the
unamb x _|_ = x unamb _|_ x = x unamb x x = x
This function is only well-defined when the arguments are
constrained to be either equal or
_|_. Using it in other
capacities will break purity.
In particular, it is always safe to use on the
This is a reimplementation of the
unamb package by Conal
Elliott. This package implements a custom thread scheduler,
whose purpose is to make feasabile "dense" uses of
unamb such as:
foldr1 unamb [ if x == 100 then 100 else never | x <- [0..] ]
Race two actions against each other, returning the value of the first one to finish.
Unambiguous choice. Calling
unamb x y has a proof obligation
x = _|_@ and @y = _|_ then
x = y. If this is satisfied,
returns the more defined of the two.