Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines the AssertM
monad, which allows you either to run assertions
as ordinary unit tests or to evaluate them as pure functions.
Synopsis
- class Monad m => AssertM m where
- genericAssertFailure :: HasCallStack => ColorString -> m a
- genericSubAssert :: HasCallStack => Maybe String -> m a -> m a
- data AssertBool a
- boolValue :: AssertBool a -> Bool
- eitherValue :: AssertBool a -> Either String a
Documentation
class Monad m => AssertM m where Source #
A typeclass for generic assertions.
genericAssertFailure :: HasCallStack => ColorString -> m a Source #
genericSubAssert :: HasCallStack => Maybe String -> m a -> m a Source #
Instances
AssertM AssertBool Source # | |
Defined in Test.Framework.AssertM genericAssertFailure :: HasCallStack => ColorString -> AssertBool a Source # genericSubAssert :: HasCallStack => Maybe String -> AssertBool a -> AssertBool a Source # | |
AssertM IO Source # | |
Defined in Test.Framework.AssertM genericAssertFailure :: HasCallStack => ColorString -> IO a Source # genericSubAssert :: HasCallStack => Maybe String -> IO a -> IO a Source # |
data AssertBool a Source #
Type for evaluating a generic assertion as a pure function.
AssertOk a | Assertion passes successfully and yields the given value. |
AssertFailed HtfStack String | Assertion fails with the given stack trace. In the stack trace, the outermost stackframe comes first. |
Instances
eitherValue :: AssertBool a -> Either String a Source #
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.