[darcs-devel] [patch1729] clean up partitioning functions and expo... (and 3 more)

Ben Franksen ben.franksen at online.de
Tue Oct 9 17:30:53 UTC 2018


Am 06.10.2018 um 15:06 schrieb Ganesh Sittampalam:
> These two are fine too. Darcs.Patch.Ident is a bit of a
> mishmash of different things, including properties
> which we haven't traditionally put in the main code (but
> I don't really mind if we start doing so).

I like to have properties in the same module as the type/class
definitions as a sort of formal specification. I think this is extremely
helpful when reading unfamiliar code.

The disadvantage is that we cannot use helper functions from the test
suite, which makes it difficult to effectively re-use (i.e. import) the
properties there. There is also the issue with good output when a
property test fails. In the test suite we have manually added detailed
contextual output for many properties because otherwise the failing test
case is extremely hard to understand and debug; but we don't want that
in the main code base where the it would subvert its purpose which is
documentation.

I wish there was a way to do this with less cluttering of the property
code and less repetition. Some kind of annotation for contextual
variables that prints their names and values on failure... I have no
idea if that is possible in Haskell. It would make a nice master thesis
to add that as a library or perhaps an external tool. If you happen to
know a student who would be interested...

Cheers
Ben


More information about the darcs-devel mailing list