- newtype Arse = Arse String
- assertMessage :: String -> String -> (a -> a) -> a -> a
- byEq :: (Eq x, Show x) => (Bool -> a -> a) -> String -> x -> x -> a -> a
- byOrd :: (Ord x, Show x) => (Bool -> a -> a) -> String -> Ordering -> x -> x -> a -> a
- byPred :: Show x => (Bool -> a -> a) -> String -> (x -> Bool) -> x -> a -> a
- assert :: Bool -> a -> a
The name comes from abbreviating ‘assert’ and translating the result to my native tongue.
Assert that two values are equal.
byEq assert "Bool" False True ()*** Exception: … Assertion failed "Bool", False ≠ True
Assert that two values obey the given
byOrd assert "Int" LT 0 1 ()()
Assert that a value satisfies the given predicate.
byPred assert "Odd" odd 4 ()*** Exception: … Assertion failed "Odd", 4
If the first argument evaluates to
True, then the result is the
second argument. Otherwise an
AssertionFailed exception is raised,
String with the source file and line number of the
Assertions can normally be turned on or off with a compiler flag
(for GHC, assertions are normally on unless optimisation is turned on
-O or the
option is given). When assertions are turned off, the first
assert is ignored, and the second argument is
returned as the result.