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