[Haskell-cafe] "doctest" for haskell -- a good project?

Shaun Cutts shaun at cuttshome.net
Sat Mar 22 17:16:40 EDT 2008


> 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.
> Best shown by
> an example:
> 

By the way, python does this by creating a temporary module from the
docstring, then evaluating this. Is there a dynamic way in Haskell to
evaulate a module? Or will I have to be content starting some sort of
"subsession"... Which will make the doctest module less robust & portable.

One idea would be just to produce a set of modules in the "core" doctest
module. Then there would be a set of lightweight scripts for automating
"produce & run" in various environments.

But if there is a good "internal" way that I don't know about, I'm all ears.

- Shaun



More information about the Haskell-Cafe mailing list