Portability | non-portable |
---|---|
Stability | experimental (MPTC, non-standarad instances) |
Maintainer | alfonso.acosta@gmail.com |
Type-level Booleans.
- class BoolI b => Bool b
- toBool :: BoolI b => b -> Bool
- data False
- false :: False
- data True
- true :: True
- reifyBool :: Bool -> (forall b. Bool b => b -> r) -> r
- class (BoolI b1, BoolI b2) => Not b1 b2 | b1 -> b2, b2 -> b1
- not :: Not b1 b2 => b1 -> b2
- class (BoolI b1, BoolI b2, BoolI b3) => And b1 b2 b3 | b1 b2 -> b3
- (&&) :: And b1 b2 b3 => b1 -> b2 -> b3
- class (BoolI b1, BoolI b2, BoolI b3) => Or b1 b2 b3 | b1 b2 -> b3
- (||) :: Or b1 b2 b3 => b1 -> b2 -> b3
- class (BoolI b1, BoolI b2, BoolI b3) => Xor b1 b2 b3 | b1 b2 -> b3
- xor :: Xor b1 b2 b3 => b1 -> b2 -> b3
- class (BoolI b1, BoolI b2, BoolI b3) => Imp b1 b2 b3 | b1 b2 -> b3
- imp :: Imp b1 b2 b3 => b1 -> b2 -> b3
- class (BoolI b1, BoolI b2, BoolI b3) => Eq b1 b2 b3 | b1 b2 -> b3
- eq :: Eq b1 b2 b3 => b1 -> b2 -> b3
Type-level boolean values
False type-level value
True type-level value
Show True | |
Typeable True | |
BoolI True | |
Not False True | |
Not True False | |
IsZero D0 True | |
Eq False False True | |
Eq False True False | |
Eq True False False | |
Eq True True True | |
Imp False False True | |
Imp False True True | |
Imp True False False | |
Imp True True True | |
Xor False True True | |
Xor True False True | |
Xor True True False | |
Or False True True | |
Or True False True | |
Or True True True | |
And False True False | |
And True False False | |
And True True True | |
Nat x => GCD' x D0 True cmp D0 | |
(Pos b, b :>=: D2) => LogBaseF' b b D1 True EQ | |
Failure (PredecessorOfZeroError x) => Succ' (x, x) (x, x) D0 D0 True |
reifyBool :: Bool -> (forall b. Bool b => b -> r) -> rSource
Reification function. In CPS style (best possible solution)
Type-level boolean operations
class (BoolI b1, BoolI b2) => Not b1 b2 | b1 -> b2, b2 -> b1Source
Boolean negation type-level relation. Not b1 b2
establishes that
not b1 = b2
class (BoolI b1, BoolI b2, BoolI b3) => And b1 b2 b3 | b1 b2 -> b3Source
And
type-level relation. And b1 b2 b3
establishes that
b1 && b2 = b3
(&&) :: And b1 b2 b3 => b1 -> b2 -> b3Source
value-level reflection function for the And
type-level relation
class (BoolI b1, BoolI b2, BoolI b3) => Or b1 b2 b3 | b1 b2 -> b3Source
Or type-level relation. Or b1 b2 b3
establishes that
b1 || b2 = b3
(||) :: Or b1 b2 b3 => b1 -> b2 -> b3Source
value-level reflection function for the Or
type-level relation
class (BoolI b1, BoolI b2, BoolI b3) => Xor b1 b2 b3 | b1 b2 -> b3Source
Exclusive or type-level relation. Xor b1 b2 b3
establishes that
xor b1 b2 = b3
xor :: Xor b1 b2 b3 => b1 -> b2 -> b3Source
value-level reflection function for the Xor
type-level relation
class (BoolI b1, BoolI b2, BoolI b3) => Imp b1 b2 b3 | b1 b2 -> b3Source
Implication type-level relation. Imp b1 b2 b3
establishes that
b1 =>b2 = b3
imp :: Imp b1 b2 b3 => b1 -> b2 -> b3Source
value-level reflection function for the Imp type-level relation