
16 Apr
2013
16 Apr
'13
1:23 p.m.
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.