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 &&.

Minimal complete definition

Nothing

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 # 
Instance details

Defined in Data.Algebra.Boolean

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 # 
Instance details

Defined in Data.Algebra.Boolean

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 # 
Instance details

Defined in Data.Algebra.Boolean

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 # 
Instance details

Defined in Data.Algebra.Boolean

Boolean (Endo Bool) Source # 
Instance details

Defined in Data.Algebra.Boolean

(Num a, Bits a) => Boolean (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

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

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

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

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

Defined in Data.Algebra.Boolean

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 # 
Instance details

Defined in Data.Algebra.Boolean

Enum a => Enum (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Eq a => Eq (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Methods

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

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

Integral a => Integral (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Data a => Data (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Methods

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

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

toConstr :: Bitwise a -> Constr Source #

dataTypeOf :: Bitwise a -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Num a => Num (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Ord a => Ord (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Read a => Read (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Real a => Real (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Show a => Show (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Ix a => Ix (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

PrintfArg a => PrintfArg (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Storable a => Storable (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

Methods

sizeOf :: Bitwise a -> Int Source #

alignment :: Bitwise a -> Int Source #

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

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

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

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

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

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

Bits a => Bits (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

(Num a, Bits a) => Boolean (Bitwise a) Source # 
Instance details

Defined in Data.Algebra.Boolean

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

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

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