cond-0.4.1.1: Basic conditional and boolean operators with monadic variants.

Safe HaskellNone
LanguageHaskell98

Data.Algebra.Boolean

Synopsis

Documentation

class Boolean b where #

A class for boolean algebras. Instances of this class are expected to obey all the laws of boolean algebra.

Minimal complete definition: true or false, not or <-->, || or &&.

Methods

true :: b #

Truth value, defined as the top of the bounded lattice

false :: b #

False value, defined as the bottom of the bounded lattice.

not :: b -> b #

Logical negation.

(&&) :: b -> b -> b infixr 3 #

Logical conjunction. (infxr 3)

(||) :: b -> b -> b infixr 2 #

Logical inclusive disjunction. (infixr 2)

xor :: b -> b -> b infixr 1 #

Logical exclusive disjunction. (infixr 1)

(-->) :: b -> b -> b infixr 1 #

Logical implication. (infixr 1)

(<-->) :: b -> b -> b infixr 1 #

Logical biconditional. (infixr 1)

and :: Foldable t => t b -> b #

The logical conjunction of several values.

or :: Foldable t => t b -> b #

The logical disjunction of several values.

nand :: Foldable t => t b -> b #

The negated logical conjunction of several values.

nand = not . and

all :: Foldable t => (a -> b) -> t a -> b #

The logical conjunction of the mapping of a function over several values.

any :: Foldable t => (a -> b) -> t a -> b #

The logical disjunction of the mapping of a function over several values.

nor :: Foldable t => t b -> b #

The negated logical disjunction of several values.

nor = not . or

Instances

Boolean Bool # 

Methods

true :: Bool #

false :: Bool #

not :: Bool -> Bool #

(&&) :: Bool -> Bool -> Bool #

(||) :: Bool -> Bool -> Bool #

xor :: Bool -> Bool -> Bool #

(-->) :: Bool -> Bool -> Bool #

(<-->) :: Bool -> Bool -> Bool #

and :: Foldable t => t Bool -> Bool #

or :: Foldable t => t Bool -> Bool #

nand :: Foldable t => t Bool -> Bool #

all :: Foldable t => (a -> Bool) -> t a -> Bool #

any :: Foldable t => (a -> Bool) -> t a -> Bool #

nor :: Foldable t => t Bool -> Bool #

Boolean All # 

Methods

true :: All #

false :: All #

not :: All -> All #

(&&) :: All -> All -> All #

(||) :: All -> All -> All #

xor :: All -> All -> All #

(-->) :: All -> All -> All #

(<-->) :: All -> All -> All #

and :: Foldable t => t All -> All #

or :: Foldable t => t All -> All #

nand :: Foldable t => t All -> All #

all :: Foldable t => (a -> All) -> t a -> All #

any :: Foldable t => (a -> All) -> t a -> All #

nor :: Foldable t => t All -> All #

Boolean Any # 

Methods

true :: Any #

false :: Any #

not :: Any -> Any #

(&&) :: Any -> Any -> Any #

(||) :: Any -> Any -> Any #

xor :: Any -> Any -> Any #

(-->) :: Any -> Any -> Any #

(<-->) :: Any -> Any -> Any #

and :: Foldable t => t Any -> Any #

or :: Foldable t => t Any -> Any #

nand :: Foldable t => t Any -> Any #

all :: Foldable t => (a -> Any) -> t a -> Any #

any :: Foldable t => (a -> Any) -> t a -> Any #

nor :: Foldable t => t Any -> Any #

Boolean (Dual Bool) # 

Methods

true :: Dual Bool #

false :: Dual Bool #

not :: Dual Bool -> Dual Bool #

(&&) :: Dual Bool -> Dual Bool -> Dual Bool #

(||) :: Dual Bool -> Dual Bool -> Dual Bool #

xor :: Dual Bool -> Dual Bool -> Dual Bool #

(-->) :: Dual Bool -> Dual Bool -> Dual Bool #

(<-->) :: Dual Bool -> Dual Bool -> Dual Bool #

and :: Foldable t => t (Dual Bool) -> Dual Bool #

or :: Foldable t => t (Dual Bool) -> Dual Bool #

nand :: Foldable t => t (Dual Bool) -> Dual Bool #

all :: Foldable t => (a -> Dual Bool) -> t a -> Dual Bool #

any :: Foldable t => (a -> Dual Bool) -> t a -> Dual Bool #

nor :: Foldable t => t (Dual Bool) -> Dual Bool #

Boolean (Endo Bool) # 

Methods

true :: Endo Bool #

false :: Endo Bool #

not :: Endo Bool -> Endo Bool #

(&&) :: Endo Bool -> Endo Bool -> Endo Bool #

(||) :: Endo Bool -> Endo Bool -> Endo Bool #

xor :: Endo Bool -> Endo Bool -> Endo Bool #

(-->) :: Endo Bool -> Endo Bool -> Endo Bool #

(<-->) :: Endo Bool -> Endo Bool -> Endo Bool #

and :: Foldable t => t (Endo Bool) -> Endo Bool #

or :: Foldable t => t (Endo Bool) -> Endo Bool #

nand :: Foldable t => t (Endo Bool) -> Endo Bool #

all :: Foldable t => (a -> Endo Bool) -> t a -> Endo Bool #

any :: Foldable t => (a -> Endo Bool) -> t a -> Endo Bool #

nor :: Foldable t => t (Endo Bool) -> Endo Bool #

(Num a, Bits a) => Boolean (Bitwise a) # 

Methods

true :: Bitwise a #

false :: Bitwise a #

not :: Bitwise a -> Bitwise a #

(&&) :: Bitwise a -> Bitwise a -> Bitwise a #

(||) :: Bitwise a -> Bitwise a -> Bitwise a #

xor :: Bitwise a -> Bitwise a -> Bitwise a #

(-->) :: Bitwise a -> Bitwise a -> Bitwise a #

(<-->) :: Bitwise a -> Bitwise a -> Bitwise a #

and :: Foldable t => t (Bitwise a) -> Bitwise a #

or :: Foldable t => t (Bitwise a) -> Bitwise a #

nand :: Foldable t => t (Bitwise a) -> Bitwise a #

all :: Foldable t => (a -> Bitwise a) -> t a -> Bitwise a #

any :: Foldable t => (a -> Bitwise a) -> t a -> Bitwise a #

nor :: Foldable t => t (Bitwise a) -> Bitwise a #

(Boolean x, Boolean y) => Boolean (x, y) # 

Methods

true :: (x, y) #

false :: (x, y) #

not :: (x, y) -> (x, y) #

(&&) :: (x, y) -> (x, y) -> (x, y) #

(||) :: (x, y) -> (x, y) -> (x, y) #

xor :: (x, y) -> (x, y) -> (x, y) #

(-->) :: (x, y) -> (x, y) -> (x, y) #

(<-->) :: (x, y) -> (x, y) -> (x, y) #

and :: Foldable t => t (x, y) -> (x, y) #

or :: Foldable t => t (x, y) -> (x, y) #

nand :: Foldable t => t (x, y) -> (x, y) #

all :: Foldable t => (a -> (x, y)) -> t a -> (x, y) #

any :: Foldable t => (a -> (x, y)) -> t a -> (x, y) #

nor :: Foldable t => t (x, y) -> (x, y) #

fromBool :: Boolean b => Bool -> b #

Injection from Bool into a boolean algebra.

newtype Bitwise a #

A newtype wrapper that derives a Boolean instance from any type that is both a Bits instance and a Num instance, such that boolean logic operations on the Bitwise wrapper correspond to bitwise logic operations on the inner type. It should be noted that false is defined as Bitwise 0 and true is defined as not false.

In addition, a number of other classes are automatically derived from the inner type. These classes were chosen on the basis that many other Bits instances defined in base are also instances of these classes.

Constructors

Bitwise 

Fields

Instances

Bounded a => Bounded (Bitwise a) # 
Enum a => Enum (Bitwise a) # 

Methods

succ :: Bitwise a -> Bitwise a #

pred :: Bitwise a -> Bitwise a #

toEnum :: Int -> Bitwise a #

fromEnum :: Bitwise a -> Int #

enumFrom :: Bitwise a -> [Bitwise a] #

enumFromThen :: Bitwise a -> Bitwise a -> [Bitwise a] #

enumFromTo :: Bitwise a -> Bitwise a -> [Bitwise a] #

enumFromThenTo :: Bitwise a -> Bitwise a -> Bitwise a -> [Bitwise a] #

Eq a => Eq (Bitwise a) # 

Methods

(==) :: Bitwise a -> Bitwise a -> Bool #

(/=) :: Bitwise a -> Bitwise a -> Bool #

Integral a => Integral (Bitwise a) # 

Methods

quot :: Bitwise a -> Bitwise a -> Bitwise a #

rem :: Bitwise a -> Bitwise a -> Bitwise a #

div :: Bitwise a -> Bitwise a -> Bitwise a #

mod :: Bitwise a -> Bitwise a -> Bitwise a #

quotRem :: Bitwise a -> Bitwise a -> (Bitwise a, Bitwise a) #

divMod :: Bitwise a -> Bitwise a -> (Bitwise a, Bitwise a) #

toInteger :: Bitwise a -> Integer #

Data a => Data (Bitwise a) # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bitwise a -> c (Bitwise a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Bitwise a) #

toConstr :: Bitwise a -> Constr #

dataTypeOf :: Bitwise a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Bitwise a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Bitwise a)) #

gmapT :: (forall b. Data b => b -> b) -> Bitwise a -> Bitwise a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bitwise a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bitwise a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Bitwise a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Bitwise a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bitwise a -> m (Bitwise a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bitwise a -> m (Bitwise a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bitwise a -> m (Bitwise a) #

Num a => Num (Bitwise a) # 

Methods

(+) :: Bitwise a -> Bitwise a -> Bitwise a #

(-) :: Bitwise a -> Bitwise a -> Bitwise a #

(*) :: Bitwise a -> Bitwise a -> Bitwise a #

negate :: Bitwise a -> Bitwise a #

abs :: Bitwise a -> Bitwise a #

signum :: Bitwise a -> Bitwise a #

fromInteger :: Integer -> Bitwise a #

Ord a => Ord (Bitwise a) # 

Methods

compare :: Bitwise a -> Bitwise a -> Ordering #

(<) :: Bitwise a -> Bitwise a -> Bool #

(<=) :: Bitwise a -> Bitwise a -> Bool #

(>) :: Bitwise a -> Bitwise a -> Bool #

(>=) :: Bitwise a -> Bitwise a -> Bool #

max :: Bitwise a -> Bitwise a -> Bitwise a #

min :: Bitwise a -> Bitwise a -> Bitwise a #

Read a => Read (Bitwise a) # 
Real a => Real (Bitwise a) # 

Methods

toRational :: Bitwise a -> Rational #

Show a => Show (Bitwise a) # 

Methods

showsPrec :: Int -> Bitwise a -> ShowS #

show :: Bitwise a -> String #

showList :: [Bitwise a] -> ShowS #

Ix a => Ix (Bitwise a) # 

Methods

range :: (Bitwise a, Bitwise a) -> [Bitwise a] #

index :: (Bitwise a, Bitwise a) -> Bitwise a -> Int #

unsafeIndex :: (Bitwise a, Bitwise a) -> Bitwise a -> Int

inRange :: (Bitwise a, Bitwise a) -> Bitwise a -> Bool #

rangeSize :: (Bitwise a, Bitwise a) -> Int #

unsafeRangeSize :: (Bitwise a, Bitwise a) -> Int

PrintfArg a => PrintfArg (Bitwise a) # 
Storable a => Storable (Bitwise a) # 

Methods

sizeOf :: Bitwise a -> Int #

alignment :: Bitwise a -> Int #

peekElemOff :: Ptr (Bitwise a) -> Int -> IO (Bitwise a) #

pokeElemOff :: Ptr (Bitwise a) -> Int -> Bitwise a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Bitwise a) #

pokeByteOff :: Ptr b -> Int -> Bitwise a -> IO () #

peek :: Ptr (Bitwise a) -> IO (Bitwise a) #

poke :: Ptr (Bitwise a) -> Bitwise a -> IO () #

Bits a => Bits (Bitwise a) # 
(Num a, Bits a) => Boolean (Bitwise a) # 

Methods

true :: Bitwise a #

false :: Bitwise a #

not :: Bitwise a -> Bitwise a #

(&&) :: Bitwise a -> Bitwise a -> Bitwise a #

(||) :: Bitwise a -> Bitwise a -> Bitwise a #

xor :: Bitwise a -> Bitwise a -> Bitwise a #

(-->) :: Bitwise a -> Bitwise a -> Bitwise a #

(<-->) :: Bitwise a -> Bitwise a -> Bitwise a #

and :: Foldable t => t (Bitwise a) -> Bitwise a #

or :: Foldable t => t (Bitwise a) -> Bitwise a #

nand :: Foldable t => t (Bitwise a) -> Bitwise a #

all :: Foldable t => (a -> Bitwise a) -> t a -> Bitwise a #

any :: Foldable t => (a -> Bitwise a) -> t a -> Bitwise a #

nor :: Foldable t => t (Bitwise a) -> Bitwise a #