packages with orphaned instances only

Christian Maeder Christian.Maeder at dfki.de
Fri Jan 7 14:42:16 CET 2011


Am 07.01.2011 14:14, schrieb Ivan Lazar Miljenovic:
> My biggest problem with "official" instances such as these is that
> they may not do what you want.  For example, I have a lot of problems
> with the testsuite for graphviz because the default list (and hence
> String) instances do not match the behaviour required, so I have to be
> careful to make sure I use my custom arbString, etc. functions rather
> than directly calling arbitrary.

This is a deficiency of classes in general that needs to be circumvented
by other functions (like QuickCheck's forAll with a custom generator)
new types (e.g. by newtype) or new classes.

> That said, if these packages have one-instance-per-module (as in
> separate modules defining the Arbitrary instances for Map, Set, etc.)
> then this situation is greatly reduced, since if I want a custom Map
> instance I just have to make sure I don't import the module that
> provides the default one.

It would also be handy (for debugging purposes) if the Show instances
could be changed for specific component types, but that's not really
possible, too.

C.



More information about the Libraries mailing list