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
Boolean All Source # | |
Defined in Data.Algebra.Boolean Methods (&&) :: 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 # | |
Boolean Any Source # | |
Defined in Data.Algebra.Boolean Methods (&&) :: 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 # | |
Boolean Bool Source # | |
Defined in Data.Algebra.Boolean Methods (&&) :: 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 # | |
Boolean (Dual Bool) Source # | |
Defined in Data.Algebra.Boolean Methods 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 # | |
Boolean (Endo Bool) Source # | |
Defined in Data.Algebra.Boolean Methods 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 # | |
(Num a, Bits a) => Boolean (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean Methods 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 # | |
(Boolean x, Boolean y) => Boolean (x, y) Source # | |
Defined in Data.Algebra.Boolean Methods 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 # |
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
Data a => Data (Bitwise a) Source # | |
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 # | |
Defined in Data.Algebra.Boolean Methods 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 () | |
Bits a => Bits (Bitwise a) Source # | |
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 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 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 | |
Bounded a => Bounded (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean | |
Enum a => Enum (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean | |
Ix a => Ix (Bitwise a) Source # | |
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 # | |
Read a => Read (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean | |
Integral a => Integral (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean | |
Real a => Real (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean Methods toRational :: Bitwise a -> Rational | |
Show a => Show (Bitwise a) Source # | |
PrintfArg a => PrintfArg (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean | |
(Num a, Bits a) => Boolean (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean Methods 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 # | |
Eq a => Eq (Bitwise a) Source # | |
Ord a => Ord (Bitwise a) Source # | |
Defined in Data.Algebra.Boolean |