[Haskell-cafe] The instability of Haskell libraries

Henning Thielemann schlepptop at henning-thielemann.de
Sun Apr 25 17:57:09 EDT 2010


Ivan Lazar Miljenovic schrieb:
> Henning Thielemann <schlepptop at henning-thielemann.de> writes:
>> My conclusion was: Never define orphan instances privately. If an
>> instance cannot be added to the packages that provide the associated
>> type or the class, then discuss the orphan instance with the maintainers
>> of the type and the class and setup a package that provides that
>> instance.
> 
> So you recommend having packages specifically for instances?
> 
> My main problem with this is if you want a custom variant of that
> instance.  Let's take FGL graphs for example with instances for
> QuickCheck's Arbitrary class.  Maybe you want arbitrary graphs that are
> simple, or maybe multiple edges are fine.  Even when considering
> Arbitrary instances for something like String you may wish to have a
> custom variant that makes sense for what you're testing.

Especially multiple instances warrant a lot of trouble:
   http://www.haskell.org/haskellwiki/Multiple_instances

If there isn't one natural instance, then define no instance at all and
instead define 'newtypes' and instances on them.



More information about the Haskell-Cafe mailing list