unamb-0.1.7: Unambiguous choiceSource codeContentsIndex
Data.Unamb
Stabilityexperimental
Maintainerconal@conal.net
Contents
Some useful special applications of amb
Description

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, http://haskell.org/haskellwiki/Lub.

Synopsis
unamb :: a -> a -> a
assuming :: Bool -> a -> a
asAgree :: Eq a => a -> a -> a
amb :: a -> a -> IO a
race :: IO a -> IO a -> IO a
parCommute :: (a -> a -> b) -> a -> a -> b
parIdentity :: Eq a => (a -> a -> a) -> a -> a -> a -> a
parAnnihilator :: Eq a => (a -> a -> a) -> a -> a -> a -> a
por :: Bool -> Bool -> Bool
pand :: Bool -> Bool -> Bool
pmin :: (Ord a, Bounded a) => a -> a -> a
pmax :: (Ord a, Bounded a) => a -> a -> a
pmult :: Num a => a -> a -> a
Documentation
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 undefined.
asAgree :: Eq a => a -> a -> aSource
The value of agreeing values (or undefined/bottom)
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.
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.
parIdentity :: Eq a => (a -> a -> a) -> a -> a -> a -> aSource
Binary operation with left & right identity element. For instance, (*) & 1, (&&) & True, (||) & False, min & maxBound, max & minBound. Tests either argument as identity, in parallel.
parAnnihilator :: Eq a => (a -> a -> a) -> a -> a -> a -> aSource
Binary operation with annihilator element. For instance, (*) & 0, (&&) & False, (||) & True, min & minBound, max & maxBound. Tests either argument as annihilator, in parallel.
por :: Bool -> Bool -> BoolSource
Parallel or
pand :: Bool -> Bool -> BoolSource
Parallel and
pmin :: (Ord a, Bounded a) => a -> a -> aSource
Parallel min with minBound short-circuit
pmax :: (Ord a, Bounded a) => a -> a -> aSource
Parallel max with maxBound short-circuit
pmult :: Num a => a -> a -> aSource
Parallel multiplication with 0 short-circuit
Produced by Haddock version 2.4.2