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 Source #

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 Source #

Truth value, defined as the top of the bounded lattice

false :: b Source #

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

not :: b -> b Source #

Logical negation.

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

Logical conjunction. (infxr 3)

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

Logical inclusive disjunction. (infixr 2)

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

Logical exclusive disjunction. (infixr 1)

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

Logical implication. (infixr 1)

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

Logical biconditional. (infixr 1)

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

The logical conjunction of several values.

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

The logical disjunction of several values.

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

The negated logical conjunction of several values.

nand = not . and

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

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

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

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

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

The negated logical disjunction of several values.

nor = not . or

Instances

Boolean Bool Source # 

Methods

true :: Bool Source #

false :: Bool Source #

not :: Bool -> Bool Source #

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

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

xor :: Bool -> Bool -> Bool Source #

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

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

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

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

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

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

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

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

Boolean All Source # 

Methods

true :: All Source #

false :: All Source #

not :: All -> All Source #

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

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

xor :: All -> All -> All Source #

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

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

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

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

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

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

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

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

Boolean Any Source # 

Methods

true :: Any Source #

false :: Any Source #

not :: Any -> Any Source #

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

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

xor :: Any -> Any -> Any Source #

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

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

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

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

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

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

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

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

Boolean (Dual Bool) Source # 
Boolean (Endo Bool) Source # 
(Num a, Bits a) => Boolean (Bitwise a) Source # 

Methods

true :: Bitwise a Source #

false :: Bitwise a Source #

not :: Bitwise a -> Bitwise a Source #

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

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

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

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

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

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

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

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

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

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

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

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

Methods

true :: (x, y) Source #

false :: (x, y) Source #

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

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

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

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

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

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

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

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

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

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

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

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

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

Injection from Bool into a boolean algebra.

newtype Bitwise a Source #

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) Source # 
Enum a => Enum (Bitwise a) Source # 

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) Source # 

Methods

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

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

Integral a => Integral (Bitwise a) Source # 

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) Source # 

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) Source # 

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) Source # 

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) Source # 
Real a => Real (Bitwise a) Source # 

Methods

toRational :: Bitwise a -> Rational #

Show a => Show (Bitwise a) Source # 

Methods

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

show :: Bitwise a -> String #

showList :: [Bitwise a] -> ShowS #

Ix a => Ix (Bitwise a) Source # 

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) Source # 
Storable a => Storable (Bitwise a) Source # 

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) Source # 
(Num a, Bits a) => Boolean (Bitwise a) Source # 

Methods

true :: Bitwise a Source #

false :: Bitwise a Source #

not :: Bitwise a -> Bitwise a Source #

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

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

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

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

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

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

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

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

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

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

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