unamb-0.1.0: Unambiguous choiceSource codeContentsIndex
Data.Unamb
Stabilityexperimental
Maintainerconal@conal.net
Description
Unambiguous choice
Synopsis
bottom :: a
unamb :: a -> a -> a
assuming :: Bool -> a -> a
asAgree :: Eq a => a -> a -> a
hang :: a
amb :: a -> a -> IO a
race :: IO a -> IO a -> IO a
Documentation
bottom :: aSource
A bottom value, allowing no information out. A left- and right- identity for unamb. At the top level, evaluating bottom results in the message Exception: thread blocked indefinitely.
unamb :: a -> a -> aSource
Unambiguous choice operator. Equivalent to the ambiguous choice operator, but with arguments restricted to be equal where not bottom, so that the choice doesn't matter. See also amb.
assuming :: Bool -> a -> aSource
Yield a value if a condition is true. Otherwise wait forever.
asAgree :: Eq a => a -> a -> aSource
The value of agreeing values (or hang)
hang :: aSource
Never yield an answer. Like undefined or 'error whatever', but don't raise an error, and don't consume computational resources.
amb :: a -> a -> IO aSource
Ambiguous choice operator. Yield either value. Evaluates in separate threads and picks whichever finishes first. See also unamb and race.
race :: IO a -> IO a -> IO aSource
Race two actions against each other in separate threads, and pick whichever finishes first. See also amb. Thanks to Spencer Janssen for this simple version.
Produced by Haddock version 2.4.2