[Haskell-cafe] "doctest" for haskell -- a good project?
Shaun Cutts
shaun at cuttshome.net
Sat Mar 22 14:02:16 EDT 2008
> > resemble a formal specification. For a couple of
> examples, see my
> > RangedSet package and Neil Mitchel's FilePath package. I manually
> > copied the RangedSet tests into the Haddock documentation,
> while Neil
> > wrote a small Haskell script to extract his tests from his
> > documentation automatically. Unfortunately his script is tied to
> > specific aspects of his FilePath package.
>
> Yes, the problem was that FilePath wants to execute half the
> tests twice with different modules, and half with just one
> namespace. As far as tests go, this is a very wacky
> requirement. I wanted to generalise it into a tool, but
> couldn't find a sensible generalisation that still worked
> with filepath - and hence didn't bother. I think the solution
> is to not permit the quirkyness of filepath, and write a
> general solution for everything else.
Niel -- I understand your script is part of FilePath... might it be a good
starting point for abstraction? Can you point me to it?
> As someone who has frequently considered writing this, even
> going as far as brainstorming on a whiteboard, I would be an
> enthusiastic user of this. I think the lack of this tool in
> Haskell is a big hole which someone needs to fill. I
> particularly like the facility in FilePath:
>
> -- > x == reverse (reverse x)
> -- > reverse "neil" = "lien"
>
> i.e. I can write both quickcheck properties (quantified over
> all single letter variables), or I can write an instance
> (like doctest in
> Python)
>
> Thanks, and good luck!
>
> Neil
>
Thank you for the support... This might take me a while, I must warn, as
this is an "after work" project, and I am a consultant, so "after work"
often doesn't come :). But its certainly motivating to work on something
right away that could be useful (to myself as well).
- Shaun
More information about the Haskell-Cafe
mailing list