<br><br><div class="gmail_quote">On Sat, Mar 22, 2008 at 8:39 AM, Don Stewart <<a href="mailto:dons@galois.com">dons@galois.com</a>> 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">> Hello,<br>
><br>
> I am an experienced programmer, currently learning Haskell. Currently I<br>
> write many things in python. I use both the "doctest" and "unittest"<br>
> modules extensively. As I write code, I simultaneously write doctest code<br>
> in the doc strings to explain/set out the "typical narrative" of how the<br>
> code is used. Then finishing off a module I write unittests for boundary<br>
> conditions, more complex test cases, and generally code that would be<br>
> annoying to write & read in doctests.<br>
><br>
> I note that there is a unit testing framework for Haskell, but I don't see<br>
<br>
</div>There'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>
> any doctest module. Might this be a good project?<br>
> If so, suggestions as to resources would be greatly appreciated. I believe<br>
> I can't just "introspect" Haskell modules to get at<br>
> documentation/comments, like I can in python? (Why not? :)) I notice that<br>
> there are a few "documentation generators". Should I try to write an<br>
> extension of one of these? Haddock, for instance? Are there any Haddock<br>
> developers hanging out on this list, to encourage or dissuade me? :) (And<br>
> where is the Haddock doc for Haddock?)<br>
><br>
> In any case, thanks in advance for any comments & advice.<br>
<br>
</div>I'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>
> :doc map<br>
<br>
would result in:<br>
<br>
-- | 'map' @f xs@ is the list obtained by applying @f@ to each element<br>
-- of @xs@, i.e.,<br>
--<br>
-- > map f [x1, x2, ..., xn] == [f x1, f x2, ..<br>
-- > map f [x1, x2, ...] == [f x1, f x2, ...]<br>
<br>
marked up in ascii.<br>
<br>
I'm not sure if that'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 ":info map". Preferably we'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