
22 Mar
2008
22 Mar
'08
3:22 p.m.
arnarbi:
Hey Don,
On Sat, Mar 22, 2008 at 8:39 AM, Don Stewart
wrote: I'm not sure how doctest works, or how it would work in a Haskell setting, could you elaborate?
In a nutshell, Python doctest has the programmer put an example "interactive session" in a functions docstring. A doctest module then extracts those, tries running the function on the inputs and sees if it matches the output.
Ah yes. This is a great idea, and would be very useful. Haskell code is often documented with QuickCheck properties the code satisfies. Ensuring these are up to date is something that would be good to automate. It should be easier than in Python too, as fragments typically are pure, and don't require state to be initialised. -- Don