HTF-0.15.0.2: The Haskell Test Framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

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.

Synopsis

Documentation

class Monad m => AssertM m where Source #

A typeclass for generic assertions.

Methods

genericAssertFailure :: HasCallStack => ColorString -> m a Source #

genericSubAssert :: HasCallStack => Maybe String -> m a -> m a Source #

Instances

Instances details
AssertM AssertBool Source # 
Instance details

Defined in Test.Framework.AssertM

AssertM IO Source # 
Instance details

Defined in Test.Framework.AssertM

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 HtfStack String

Assertion fails with the given stack trace. In the stack trace, the outermost stackframe comes first.

Instances

Instances details
AssertM AssertBool Source # 
Instance details

Defined in Test.Framework.AssertM

Applicative AssertBool Source # 
Instance details

Defined in Test.Framework.AssertM

Methods

pure :: a -> AssertBool a #

(<*>) :: AssertBool (a -> b) -> AssertBool a -> AssertBool b #

liftA2 :: (a -> b -> c) -> AssertBool a -> AssertBool b -> AssertBool c #

(*>) :: AssertBool a -> AssertBool b -> AssertBool b #

(<*) :: AssertBool a -> AssertBool b -> AssertBool a #

Functor AssertBool Source # 
Instance details

Defined in Test.Framework.AssertM

Methods

fmap :: (a -> b) -> AssertBool a -> AssertBool b #

(<$) :: a -> AssertBool b -> AssertBool a #

Monad AssertBool Source # 
Instance details

Defined in Test.Framework.AssertM

Methods

(>>=) :: AssertBool a -> (a -> AssertBool b) -> AssertBool b #

(>>) :: AssertBool a -> AssertBool b -> AssertBool b #

return :: a -> AssertBool a #

Read a => Read (AssertBool a) Source # 
Instance details

Defined in Test.Framework.AssertM

Show a => Show (AssertBool a) Source # 
Instance details

Defined in Test.Framework.AssertM

Eq a => Eq (AssertBool a) Source # 
Instance details

Defined in Test.Framework.AssertM

Methods

(==) :: AssertBool a -> AssertBool a -> Bool #

(/=) :: AssertBool a -> AssertBool a -> Bool #

Ord a => Ord (AssertBool a) Source # 
Instance details

Defined in Test.Framework.AssertM

boolValue :: AssertBool a -> Bool Source #

Evaluates a generic assertion to a Bool value.

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.