[Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

Ross Paterson R.Paterson at city.ac.uk
Tue Apr 16 19:23:54 CEST 2013


On Tue, Apr 16, 2013 at 10:17:48AM +0100, Tom Crayford wrote:
>  The core API is very simple:
> 
> data Matcher a = Matcher {
>     match :: a -> Bool
>   -- ^ A function that returns True if the matcher should pass, False if it
> should fail
>   , description :: String
>   -- ^ A description of the matcher (usually of its success conditions)
>   , describeMismatch :: a -> String
>   -- ^ A description to be shown if the match fails.
>   }

How about combining match and describeMismatch as a single function
of type a -> Match?  Then you wouldn't need the precondition on
describeMismatch.

Defining a Monoid instance for Match might also be useful.



More information about the Haskell-Cafe mailing list