Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type IsBool t = (HasBools t, CanNegSameType t, CanAndOrSameType t)
- specIsBool :: (IsBool t, CanTestCertainly t, Show t, Serial IO t) => T t -> Spec
- type HasBools t = ConvertibleExactly Bool t
- class HasBools t => CanTestCertainly t where
- isCertainlyTrue :: t -> Bool
- isCertainlyFalse :: t -> Bool
- specCanTestCertainly :: CanTestCertainly t => T t -> Spec
- type CanTestCertainlyX t = (CanTestCertainly t, Show t, Serial IO t)
- isNotTrue :: CanTestCertainly t => t -> Bool
- isNotFalse :: CanTestCertainly t => t -> Bool
- stronglyImplies :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool
- stronglyEquivalentTo :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool
- weaklyImplies :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool
- weaklyEquivalentTo :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool
- class CanNeg t where
- not :: CanNeg t => t -> NegType t
- type CanNegSameType t = (CanNeg t, NegType t ~ t)
- specCanNegBool :: _ => T t -> Spec
- type CanAndOr t1 t2 = (CanAndOrAsymmetric t1 t2, CanAndOrAsymmetric t2 t1, AndOrType t1 t2 ~ AndOrType t2 t1)
- class CanAndOrAsymmetric t1 t2 where
- (&&) :: CanAndOrAsymmetric a b => a -> b -> AndOrType a b
- (||) :: CanAndOrAsymmetric a b => a -> b -> AndOrType a b
- type CanAndOrWith t1 t2 = (CanAndOr t1 t2, AndOrType t1 t2 ~ t1)
- type CanAndOrSameType t = CanAndOrWith t t
- and :: (CanAndOrSameType t, CanTestCertainly t) => [t] -> t
- or :: (CanAndOrSameType t, CanTestCertainly t) => [t] -> t
- specCanAndOr :: _ => T t1 -> T t2 -> T t3 -> Spec
- specCanAndOrNotMixed :: _ => T t -> Spec
Documentation
type IsBool t = (HasBools t, CanNegSameType t, CanAndOrSameType t) Source #
A type constraint synonym that stipulates that the type behaves very much like Bool, except it does not necessarily satisfy the law of excluded middle, which means that the type can contain a "do-not-know" value or an error.
Examples: Bool
, Kleenean
, CollectErrors Bool
specIsBool :: (IsBool t, CanTestCertainly t, Show t, Serial IO t) => T t -> Spec Source #
HSpec properties that each implementation of IsBool should satisfy.
Conversion to/from Bool
type HasBools t = ConvertibleExactly Bool t Source #
class HasBools t => CanTestCertainly t where Source #
Tests for truth or falsity. Beware, when isCertainlyTrue
returns False
,
it does not mean that the proposition is false. It usually means that
we failed to prove the proposition.
isCertainlyTrue :: t -> Bool Source #
isCertainlyFalse :: t -> Bool Source #
Instances
CanTestCertainly Bool Source # | |
Defined in Numeric.MixedTypes.Bool isCertainlyTrue :: Bool -> Bool Source # isCertainlyFalse :: Bool -> Bool Source # | |
(CanTestCertainly t, CanBeErrors es) => CanTestCertainly (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Bool isCertainlyTrue :: CollectErrors es t -> Bool Source # isCertainlyFalse :: CollectErrors es t -> Bool Source # |
specCanTestCertainly :: CanTestCertainly t => T t -> Spec Source #
HSpec properties that each implementation of CanTestCertainly should satisfy.
type CanTestCertainlyX t = (CanTestCertainly t, Show t, Serial IO t) Source #
Compound type constraint useful for test definition.
isNotTrue :: CanTestCertainly t => t -> Bool Source #
isNotFalse :: CanTestCertainly t => t -> Bool Source #
stronglyImplies :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool Source #
If l is certainly True, then r is also certainly True.
stronglyEquivalentTo :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool Source #
weaklyImplies :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool Source #
If l is certainly True, then r is not certainly False.
weaklyEquivalentTo :: (CanTestCertainly t1, CanTestCertainly t2) => t1 -> t2 -> Bool Source #
Negation
This is negation is both the numeric negation as well as the Boolean negation. Example of non-standard Boolean negation:
negate (Just True) = Just False
Instances
CanNeg Bool Source # | |
CanNeg Double Source # | |
CanNeg Int Source # | |
CanNeg Integer Source # | |
CanNeg Rational Source # | |
CanNeg t => CanNeg (Complex t) Source # | |
(CanNeg t, CanBeErrors es) => CanNeg (CollectErrors es t) Source # | |
Defined in Numeric.MixedTypes.Bool type NegType (CollectErrors es t) Source # negate :: CollectErrors es t -> NegType (CollectErrors es t) Source # |
type CanNegSameType t = (CanNeg t, NegType t ~ t) Source #
Tests
specCanNegBool :: _ => T t -> Spec Source #
HSpec properties that each Boolean implementation of CanNeg should satisfy.
And and or
type CanAndOr t1 t2 = (CanAndOrAsymmetric t1 t2, CanAndOrAsymmetric t2 t1, AndOrType t1 t2 ~ AndOrType t2 t1) Source #
class CanAndOrAsymmetric t1 t2 where Source #
Binary logical and
and or
for generalised Booleans. For example:
(Just True) && False = Just False (Just (Just True)) || False = (Just (Just True))
Instances
type CanAndOrWith t1 t2 = (CanAndOr t1 t2, AndOrType t1 t2 ~ t1) Source #
type CanAndOrSameType t = CanAndOrWith t t Source #
and :: (CanAndOrSameType t, CanTestCertainly t) => [t] -> t Source #
or :: (CanAndOrSameType t, CanTestCertainly t) => [t] -> t Source #
Tests
specCanAndOr :: _ => T t1 -> T t2 -> T t3 -> Spec Source #
HSpec properties that each implementation of CanAndOr should satisfy.
specCanAndOrNotMixed :: _ => T t -> Spec Source #
HSpec properties that each implementation of CanAndOr should satisfy.