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
Instances
SemiBooleanAlgebra (Maybe a)
SemiBooleanAlgebra [a]
SemiBooleanAlgebra (Either a b)
SemiBooleanAlgebra Bool
SemiBooleanAlgebra a => SemiBooleanAlgebra (x -> a)
(SemiBooleanAlgebra a, SemiBooleanAlgebra b) => SemiBooleanAlgebra (a, b)
SemiBooleanAlgebra Int
SemiBooleanAlgebra Integer
(Monad m, SemiBooleanAlgebra a) => SemiBooleanAlgebra (m a)
SemiBooleanAlgebra (Boolean a)
Ord a => SemiBooleanAlgebra (Fuzz a)
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
Instances
BooleanAlgebra Bool
BooleanAlgebra a => BooleanAlgebra (x -> a)
(BooleanAlgebra a, BooleanAlgebra b) => BooleanAlgebra (a, b)
BooleanAlgebra Int
BooleanAlgebra Integer
(Monad m, SemiBooleanAlgebra (m a), BooleanAlgebra a) => BooleanAlgebra (m a)
BooleanAlgebra (Boolean a)
(Ord a, Num a) => BooleanAlgebra (Fuzz a)
BooleanAlgebra (TrueSet a)
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.6