<br><br><div class="gmail_quote">On Sat, Mar 22, 2008 at 8:39 AM, Don Stewart &lt;<a href="mailto:dons@galois.com">dons@galois.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
shaun:<br>
<div class="Ih2E3d">&gt; &nbsp; &nbsp;Hello,<br>
&gt;<br>
&gt; &nbsp; &nbsp;I am an experienced programmer, currently learning Haskell. Currently I<br>
&gt; &nbsp; &nbsp;write many things in python. I use both the &quot;doctest&quot; and &quot;unittest&quot;<br>
&gt; &nbsp; &nbsp;modules extensively. As I write code, I simultaneously write doctest code<br>
&gt; &nbsp; &nbsp;in the doc strings to explain/set out the &quot;typical narrative&quot; of how the<br>
&gt; &nbsp; &nbsp;code is used. Then finishing off a module I write unittests for boundary<br>
&gt; &nbsp; &nbsp;conditions, more complex test cases, and generally code that would be<br>
&gt; &nbsp; &nbsp;annoying to write &amp; read in doctests.<br>
&gt;<br>
&gt; &nbsp; &nbsp;I note that there is a unit testing framework for Haskell, but I don&#39;t see<br>
<br>
</div>There&#39;s a couple, QuickCheck is the best, it generalises unit testing to<br>
property testing with random, or not so random, data.<br>
<div class="Ih2E3d"><br>
&gt; &nbsp; &nbsp;any doctest module. Might this be a good project?<br>
&gt; &nbsp; &nbsp;If so, suggestions as to resources would be greatly appreciated. I believe<br>
&gt; &nbsp; &nbsp;I can&#39;t just &quot;introspect&quot; Haskell modules to get at<br>
&gt; &nbsp; &nbsp;documentation/comments, like I can in python? (Why not? :)) I notice that<br>
&gt; &nbsp; &nbsp;there are a few &quot;documentation generators&quot;. Should I try to write an<br>
&gt; &nbsp; &nbsp;extension of one of these? Haddock, for instance? Are there any Haddock<br>
&gt; &nbsp; &nbsp;developers hanging out on this list, to encourage or dissuade me? :) (And<br>
&gt; &nbsp; &nbsp;where is the Haddock doc for Haddock?)<br>
&gt;<br>
&gt; &nbsp; &nbsp;In any case, thanks in advance for any comments &amp; advice.<br>
<br>
</div>I&#39;m not sure how doctest works, or how it would work in a Haskell<br>
setting, could you elaborate?<br>
<br>
One idea that does strike me is that it would be super useful to have<br>
the ability in ghci to extract the haddocks associated with a function.<br>
<br>
 &nbsp; &nbsp; &gt; :doc map<br>
<br>
would result in:<br>
<br>
 &nbsp; &nbsp; -- | &#39;map&#39; @f xs@ is the list obtained by applying @f@ to each element<br>
 &nbsp; &nbsp; -- of @xs@, i.e.,<br>
 &nbsp; &nbsp; --<br>
 &nbsp; &nbsp; -- &gt; map f [x1, x2, ..., xn] == [f x1, f x2, ..<br>
 &nbsp; &nbsp; -- &gt; map f [x1, x2, ...] == [f x1, f x2, ...]<br>
<br>
marked up in ascii.<br>
<br>
I&#39;m not sure if that&#39;s related to doctest, but it sure would be useful!<br>
</blockquote><div><br>To be honest, I think this is what we should see when we type &quot;:info map&quot;. Preferably we&#39;d get a proper GUI version of GHCi which prints it out into a HTML box or something with proper hyperlinks and formatting. <br>
</div></div><br><br clear="all"><br>-- <br>Sebastian Sylvan<br>+44(0)7857-300802<br>UIN: 44640862