FilePath modification proposal

Neil Mitchell ndmitchell at gmail.com
Mon Oct 20 14:22:43 UTC 2014


> Can't something in the style of
>
>    https://hackage.haskell.org/package/doctest
>
> be used to avoid having to run a generator manually?

It would, but then instead of generating a file (pretty easy), I have
to go through the GHC API (a lot more fiddly). Alternatively, I could
just have the tester spit out a temporary .hs file and run over it in
one go - which works, but means all the nice Cabal stuff for
dependencies of the test suite get a bit lost and I have to assume a
"good" GHC on the $PATH. Both avoid checking in generated code, but
end up a bit more complex in other respects.

> Btw, Haddock has even markup support for QC properties via
> "prop>"-prefixed code-blocks.

Yes, but here I want slightly lighter weight properties (I infer what
is a variable and what isn't), and also multi-module properties (most
properties are tested against both .Windows and .Posix paths). I
almost always find I can get slightly cleaner tests by writing a
generator myself, and that the effort writing the generator is minimal
and reducing the difficulty of writing tests makes me write more of
them.

Thanks, Neil


More information about the Libraries mailing list