lub-0.0.0: least upper bounds -- information mergingSource codeContentsIndex
Data.Lub
Stabilityexperimental
Maintainerconal@conal.net
Contents
Least upper bounds
Some useful special applications of lub
Description
Compute least upper bound (lub) of two values, with respect to information content. I.e., merge the information available in each.
Synopsis
class HasLub a where
lub :: a -> a -> a
flatLub :: a -> a -> a
parCommute :: HasLub a => (a -> a -> a) -> a -> a -> a
por :: Bool -> Bool -> Bool
pand :: Bool -> Bool -> Bool
ptimes :: (HasLub a, Num a) => a -> a -> a
Least upper bounds
class HasLub a whereSource
Types that support information merging (lub)
Methods
lub :: a -> a -> aSource
Least upper information bound. Combines information available from each argument. The arguments must be consistent, i.e., must have a common upper bound.
show/hide Instances
flatLub :: a -> a -> aSource

A lub for flat domains. Equivalent to unamb. Handy for defining HasLub instances, e.g.,

   instance HasLub Integer where lub = flatLub
Some useful special applications of lub
parCommute :: HasLub a => (a -> a -> a) -> a -> a -> aSource
Turn a binary commutative operation into that tries both orders in parallel, lub-merging the results. Useful when there are special cases that don't require evaluating both arguments.
por :: Bool -> Bool -> BoolSource
Parallel or
pand :: Bool -> Bool -> BoolSource
Parallel and
ptimes :: (HasLub a, Num a) => a -> a -> aSource
Multiplication optimized for either argument being zero or one, where the other might be expensive/delayed.
Produced by Haddock version 2.3.0