Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Boolean b where
- fromBool :: Boolean b => Bool -> b
- newtype Bitwise a = Bitwise {
- getBits :: a
- and :: (Boolean b, Foldable t) => t b -> b
- or :: (Boolean b, Foldable t) => t b -> b
- nand :: (Boolean b, Foldable t) => t b -> b
- nor :: (Boolean b, Foldable t) => t b -> b
- any :: (Boolean b, Foldable t) => (a -> b) -> t a -> b
- all :: (Boolean b, Foldable t) => (a -> b) -> t a -> b
- newtype Opp a = Opp {
- getOpp :: a
- newtype AnyB b = AnyB {
- getAnyB :: b
- newtype AllB b = AllB {
- getAllB :: b
- newtype XorB b = XorB {
- getXorB :: b
- newtype EquivB b = EquivB {
- getEquivB :: b
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 (<-->
, false
), ||
or &&
.
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. (infixr 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)
Instances
Boolean All Source # | Could be done via `deriving via` from GHC8.6.1 onwards |
Boolean Any Source # | Could be done via `deriving via` from GHC8.6.1 onwards |
Boolean () Source # | The trivial boolean algebra |
Boolean Bool Source # | |
Boolean (Dual Bool) Source # | Could be done via `deriving via` from GHC8.6.1 onwards |
Boolean a => Boolean (Endo a) Source # | Could be done via `deriving via` from GHC8.6.1 onwards |
Defined in Data.Algebra.Boolean | |
(Num a, Bits a) => Boolean (Bitwise a) Source # | |
Boolean a => Boolean (Opp a) Source # | Opposite boolean algebra: exchanges true and false, and |
Defined in Data.Algebra.Boolean | |
Boolean b => Boolean (a -> b) Source # | Pointwise boolean algebra. |
(Boolean x, Boolean y) => Boolean (x, y) Source # | |
Defined in Data.Algebra.Boolean | |
(Boolean x, Boolean y, Boolean z) => Boolean (x, y, z) 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.
Instances
any :: (Boolean b, Foldable t) => (a -> b) -> t a -> b Source #
The logical disjunction of the mapping of a function over several values.
all :: (Boolean b, Foldable t) => (a -> b) -> t a -> b Source #
The logical conjunction of the mapping of a function over several values.
A boolean algebra regarded as a monoid under disjunction
A boolean algebra regarded as a monoid under conjunction
A boolean algebra regarded as a monoid under exclusive or