ContentsIndex
Boolean.Algebra
Description

This is the main module of the Boolean hierachy and provides a class which abstracts common operations on boolean algebras. note, we redefine some prelude functions, but the new definitons mean the same thing for Bool so it will not hurt existing code.

to use properly:

 import Boolean.Algebra
 import Prelude hiding((&&),(||),not,and,or,any,all)
Synopsis
class SemiBooleanAlgebra a where
(&&) :: a -> a -> a
(||) :: a -> a -> a
class SemiBooleanAlgebra a => BooleanAlgebra a where
true :: a
false :: a
not :: a -> a
xor :: a -> a -> a
and :: [a] -> a
or :: [a] -> a
any :: (x -> a) -> [x] -> a
all :: (x -> a) -> [x] -> a
and1 :: SemiBooleanAlgebra a => [a] -> a
or1 :: SemiBooleanAlgebra a => [a] -> a
fromBool :: BooleanAlgebra a => Bool -> a
Documentation
class SemiBooleanAlgebra a where

This class is mainly for syntax re-use, there are many types which are very similar to boolean algebras, but do not have suitable distinguished values to choose for true and false.

&& and || should be strict only in their first argument, and return one of their arguments if possible.

Methods
(&&) :: a -> a -> a
(||) :: a -> a -> a
show/hide Instances
class SemiBooleanAlgebra a => BooleanAlgebra a where
This is the main class, providing all the operations one would expect on a boolean algebra.
Methods
true :: a
false :: a
not :: a -> a
xor :: a -> a -> a
and :: [a] -> a
or :: [a] -> a
any :: (x -> a) -> [x] -> a
all :: (x -> a) -> [x] -> a
show/hide Instances
and1 :: SemiBooleanAlgebra a => [a] -> a
this behaves identically to and but requires there be at least one item in the list and has a more general type.
or1 :: SemiBooleanAlgebra a => [a] -> a
this behaves identically to or but requires there be at least one item in the list and has a more general type.
fromBool :: BooleanAlgebra a => Bool -> a
convert a Bool into an arbitrary membor of BooleanAlgebra.
Produced by Haddock version 0.8