unamb-0.1.2: Unambiguous choiceSource codeContentsIndex
Some useful special applications of amb

Unambiguous choice

For non-flat types (where values may be partially defined, rather than necessarily bottom or fully defined) and information merging, see the '''lub''' package.

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
parCommute :: (a -> a -> b) -> a -> a -> b
por :: Bool -> Bool -> Bool
pand :: Bool -> Bool -> Bool
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.
Some useful special applications of amb
parCommute :: (a -> a -> b) -> a -> a -> bSource
Turn a binary commutative operation into that tries both orders in parallel. Useful when there are special cases that don't require evaluating both arguments. For non-flat types and information merging, see parCommute in the lub package.
por :: Bool -> Bool -> BoolSource
Parallel or
pand :: Bool -> Bool -> BoolSource
Parallel and
Produced by Haddock version 2.4.2