<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/4/16 Ross Paterson <span dir="ltr">&lt;<a href="mailto:R.Paterson@city.ac.uk" target="_blank">R.Paterson@city.ac.uk</a>&gt;</span><br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class="im">On Tue, Apr 16, 2013 at 10:17:48AM +0100, Tom Crayford wrote:<br>
&gt;  The core API is very simple:<br>
&gt;<br>
&gt; data Matcher a = Matcher {<br>
&gt;     match :: a -&gt; Bool<br>
&gt;   -- ^ A function that returns True if the matcher should pass, False if it<br>
&gt; should fail<br>
&gt;   , description :: String<br>
&gt;   -- ^ A description of the matcher (usually of its success conditions)<br>
&gt;   , describeMismatch :: a -&gt; String<br>
&gt;   -- ^ A description to be shown if the match fails.<br>
&gt;   }<br>
<br>
</div>How about combining match and describeMismatch as a single function<br>
of type a -&gt; Match?  Then you wouldn&#39;t need the precondition on<br>
describeMismatch.<br></blockquote><div><br></div><div>And this way we&#39;d get `runMatch` right away in the data type:</div><div><br></div><div>data Matcher a = Matcher {</div><div>    runMatch :: a -&gt; Match</div><div>

  , description :: String</div><div>  }</div><div> </div></div></div></div>