Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
- 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
- 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
- type NegType t
- not :: CanNeg t => t -> NegType t
- type CanNegSameType t = (CanNeg t, NegType t ~ t)
- specCanNegBool :: (CanNegBoolX t, CanNegBoolX (NegType t)) => T t -> Spec
- type CanNegBoolX t = (CanNeg t, CanTestCertainlyX t, CanTestCertainlyX (NegType t))
- type CanAndOr t1 t2 = (CanAndOrAsymmetric t1 t2, CanAndOrAsymmetric t2 t1, AndOrType t1 t2 ~ AndOrType t2 t1)
- class CanAndOrAsymmetric t1 t2 where
- type AndOrType t1 t2
- (&&) :: 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 :: (CanAndOrX t1 t1, CanAndOrX t1 t2, CanAndOrX t2 t1, CanAndOrX t1 t3, CanAndOrX t2 t3, CanAndOrX (AndOrType t1 t2) t3, CanAndOrX t1 (AndOrType t2 t3), CanAndOrX (AndOrType t1 t2) (AndOrType t1 t3)) => T t1 -> T t2 -> T t3 -> Spec
- specCanAndOrNotMixed :: (CanAndOrX t t, CanAndOrX (AndOrType t t) t, CanAndOrX t (AndOrType t t), CanAndOrX (AndOrType t t) (AndOrType t t)) => T t -> Spec
- type CanAndOrX t1 t2 = (CanAndOr t1 t2, CanNeg t1, CanNeg t2, CanAndOr (NegType t1) t2, CanAndOr t1 (NegType t2), CanAndOr (NegType t1) (NegType t2), CanTestCertainlyX t1, CanTestCertainlyX t2, CanTestCertainlyX (AndOrType t1 t2), CanTestCertainlyX (NegType (AndOrType t1 t2)), CanTestCertainlyX (AndOrType (NegType t1) t2), CanTestCertainlyX (AndOrType t1 (NegType t2)), CanTestCertainlyX (AndOrType (NegType t1) (NegType t2)))
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.
Examples: Bool
, Maybe Bool
, Maybe (Maybe Bool)
, 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 #
CanTestCertainly Bool Source # | |
CanTestCertainly t => CanTestCertainly (Maybe t) Source # | |
(CanTestCertainly t, SuitableForCE es) => CanTestCertainly (CollectErrors es t) 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
type CanNegSameType t = (CanNeg t, NegType t ~ t) Source #
Tests
specCanNegBool :: (CanNegBoolX t, CanNegBoolX (NegType t)) => T t -> Spec Source #
HSpec properties that each Boolean implementation of CanNeg should satisfy.
type CanNegBoolX t = (CanNeg t, CanTestCertainlyX t, CanTestCertainlyX (NegType t)) Source #
Compound type constraint useful for test definition.
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))
CanAndOrAsymmetric Bool Bool Source # | |
(CanAndOrAsymmetric Bool t2, CanTestCertainly t2, CanTestCertainly (AndOrType Bool t2)) => CanAndOrAsymmetric Bool (Maybe t2) Source # | |
(CanAndOrAsymmetric Bool t2, SuitableForCE es, CanEnsureCE es (AndOrType Bool t2)) => CanAndOrAsymmetric Bool (CollectErrors es t2) Source # | |
(CanAndOrAsymmetric t1 Bool, CanTestCertainly t1, CanTestCertainly (AndOrType t1 Bool)) => CanAndOrAsymmetric (Maybe t1) Bool Source # | |
(CanAndOrAsymmetric t1 t2, CanTestCertainly t1, CanTestCertainly t2, CanTestCertainly (AndOrType t1 t2)) => CanAndOrAsymmetric (Maybe t1) (Maybe t2) Source # | |
(CanAndOrAsymmetric t1 Bool, SuitableForCE es, CanEnsureCE es (AndOrType t1 Bool)) => CanAndOrAsymmetric (CollectErrors es t1) Bool Source # | |
(CanAndOrAsymmetric t1 t2, SuitableForCE es, CanEnsureCE es (AndOrType t1 t2)) => CanAndOrAsymmetric (CollectErrors es t1) (CollectErrors es t2) Source # | |
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 :: (CanAndOrX t1 t1, CanAndOrX t1 t2, CanAndOrX t2 t1, CanAndOrX t1 t3, CanAndOrX t2 t3, CanAndOrX (AndOrType t1 t2) t3, CanAndOrX t1 (AndOrType t2 t3), CanAndOrX (AndOrType t1 t2) (AndOrType t1 t3)) => T t1 -> T t2 -> T t3 -> Spec Source #
HSpec properties that each implementation of CanAndOr should satisfy.
specCanAndOrNotMixed :: (CanAndOrX t t, CanAndOrX (AndOrType t t) t, CanAndOrX t (AndOrType t t), CanAndOrX (AndOrType t t) (AndOrType t t)) => T t -> Spec Source #
HSpec properties that each implementation of CanAndOr should satisfy.
type CanAndOrX t1 t2 = (CanAndOr t1 t2, CanNeg t1, CanNeg t2, CanAndOr (NegType t1) t2, CanAndOr t1 (NegType t2), CanAndOr (NegType t1) (NegType t2), CanTestCertainlyX t1, CanTestCertainlyX t2, CanTestCertainlyX (AndOrType t1 t2), CanTestCertainlyX (NegType (AndOrType t1 t2)), CanTestCertainlyX (AndOrType (NegType t1) t2), CanTestCertainlyX (AndOrType t1 (NegType t2)), CanTestCertainlyX (AndOrType (NegType t1) (NegType t2))) Source #
Compound type constraint useful for test definition.