| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Data.Algebra.Boolean
Synopsis
- class Boolean b where
- true :: b
- false :: b
- not :: b -> b
- (&&) :: b -> b -> b
- (||) :: b -> b -> b
- xor :: b -> b -> b
- (-->) :: b -> b -> b
- (<-->) :: b -> b -> b
- and :: Foldable t => t b -> b
- or :: Foldable t => t b -> b
- nand :: Foldable t => t b -> b
- all :: Foldable t => (a -> b) -> t a -> b
- any :: Foldable t => (a -> b) -> t a -> b
- nor :: Foldable t => t b -> b
- fromBool :: Boolean b => Bool -> b
- newtype Bitwise a = Bitwise {
- getBits :: a
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
Truth value, defined as the top of the bounded lattice
False value, defined as the bottom of the bounded lattice.
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 #
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.
Instances
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.