2013/4/16 Ross Paterson <r.pater...@city.ac.uk>

> 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.
>

And this way we'd get `runMatch` right away in the data type:

data Matcher a = Matcher {
    runMatch :: a -> Match
  , description :: String
  }
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to