cond-0.4.1.1: Basic conditional and boolean operators with monadic variants.
Safe HaskellSafe-Inferred
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

Instances details
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 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 (Dual Bool) Source # 
Instance details

Defined in Data.Algebra.Boolean

Methods

true :: Dual Bool Source #

false :: Dual Bool Source #

not :: Dual Bool -> Dual Bool Source #

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

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

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

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

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

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

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

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

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

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

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

Boolean (Endo Bool) Source # 
Instance details

Defined in Data.Algebra.Boolean

Methods

true :: Endo Bool Source #

false :: Endo Bool Source #

not :: Endo Bool -> Endo Bool Source #

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

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

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

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

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

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

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

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

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

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

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

(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

Instances details
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)

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 :: forall r r'. (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)

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

Defined in Data.Algebra.Boolean

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

Defined in Data.Algebra.Boolean

Methods

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

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

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

complement :: Bitwise a -> Bitwise a

shift :: Bitwise a -> Int -> Bitwise a

rotate :: Bitwise a -> Int -> Bitwise a

zeroBits :: Bitwise a

bit :: Int -> Bitwise a

setBit :: Bitwise a -> Int -> Bitwise a

clearBit :: Bitwise a -> Int -> Bitwise a

complementBit :: Bitwise a -> Int -> Bitwise a

testBit :: Bitwise a -> Int -> Bool

bitSizeMaybe :: Bitwise a -> Maybe Int

bitSize :: Bitwise a -> Int

isSigned :: Bitwise a -> Bool

shiftL :: Bitwise a -> Int -> Bitwise a

unsafeShiftL :: Bitwise a -> Int -> Bitwise a

shiftR :: Bitwise a -> Int -> Bitwise a

unsafeShiftR :: Bitwise a -> Int -> Bitwise a

rotateL :: Bitwise a -> Int -> Bitwise a

rotateR :: Bitwise a -> Int -> Bitwise a

popCount :: Bitwise a -> Int

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

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]

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

Defined in Data.Algebra.Boolean

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

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

Defined in Data.Algebra.Boolean

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

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

Defined in Data.Algebra.Boolean

Methods

readsPrec :: Int -> ReadS (Bitwise a)

readList :: ReadS [Bitwise a]

readPrec :: ReadPrec (Bitwise a)

readListPrec :: ReadPrec [Bitwise a]

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

Defined in Data.Algebra.Boolean

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

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

Defined in Data.Algebra.Boolean

Methods

toRational :: Bitwise a -> Rational

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

Defined in Data.Algebra.Boolean

Methods

showsPrec :: Int -> Bitwise a -> ShowS

show :: Bitwise a -> String

showList :: [Bitwise a] -> ShowS

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

Defined in Data.Algebra.Boolean

Methods

formatArg :: Bitwise a -> FieldFormatter

parseFormat :: Bitwise a -> ModifierParser

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

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

Defined in Data.Algebra.Boolean

Methods

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

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

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

Defined in Data.Algebra.Boolean

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