| Safe Haskell | Safe-Inferred |
|---|
Test.Framework.AssertM
Description
This module defines the AssertM monad, which allows you either to run assertions
as ordinary unit tests or to evaluate them as pure functions.
- class Monad m => AssertM m where
- genericAssertFailure__ :: Location -> ColorString -> m a
- genericSubAssert :: Location -> Maybe String -> m a -> m a
- data AssertStackElem = AssertStackElem {
- ase_message :: Maybe String
- ase_location :: Maybe Location
- data AssertBool a
- = AssertOk a
- | AssertFailed [AssertStackElem]
- boolValue :: AssertBool a -> Bool
- eitherValue :: AssertBool a -> Either String a
- formatStack :: [AssertStackElem] -> String
Documentation
class Monad m => AssertM m whereSource
A typeclass for generic assertions.
Methods
genericAssertFailure__ :: Location -> ColorString -> m aSource
genericSubAssert :: Location -> Maybe String -> m a -> m aSource
Instances
data AssertStackElem Source
Stack trace element for generic assertions.
Constructors
| AssertStackElem | |
Fields
| |
Instances
| Eq AssertStackElem | |
| Ord AssertStackElem | |
| Read AssertStackElem | |
| Show AssertStackElem |
data AssertBool a Source
Type for evaluating a generic assertion as a pure function.
Constructors
| AssertOk a | Assertion passes successfully and yields the given value. |
| AssertFailed [AssertStackElem] | Assertion fails with the given stack trace. In the stack trace, the outermost stackframe comes first. |
Instances
| Monad AssertBool | |
| Functor AssertBool | |
| Applicative AssertBool | |
| AssertM AssertBool | |
| Eq a => Eq (AssertBool a) | |
| Ord a => Ord (AssertBool a) | |
| Read a => Read (AssertBool a) | |
| Show a => Show (AssertBool a) |
boolValue :: AssertBool a -> BoolSource
Evaluates a generic assertion to a Bool value.
eitherValue :: AssertBool a -> Either String aSource
Evaluates a generic assertion to an Either value. The result
is Right x if the assertion passes and yields value x, otherwise
the result is Left err, where err is an error message.
formatStack :: [AssertStackElem] -> StringSource
Formats a stack trace.