Relaxin the PVP with regards to adding instances

Ian Lynagh igloo at earth.li
Tue Sep 11 21:38:44 CEST 2012


On Tue, Sep 11, 2012 at 09:10:07PM +0200, Henning Thielemann wrote:
> 
> If a package user needs a new instance he should propose to add the
> instance the package author.

In an ideal world, yes. In practice, (a) many package users don't, and
(b) many package maintainers are slow to respond, which leaves the user
the choice of waiting indefinitely, making an orphaned instance, or
spending time making hopefully-temporary ugly workarounds with newtypes.

For example, (a) I recently found that the Hackage 2 code contains some
orphaned instances (and I'd expect Hackage 2 to be amongst the best
examples in the community), and (b) the maintainer of the relevant
package hasn't yet had time to look at the patch I sent 2.5 weeks ago to
add non-orphaned instances.

> >A "no orphan instance" rule could work, but note that not only could you
> >not use orphan instances yourself, but you also couldn't use any
> >packages that contain orphan instances. I think that to make that work
> >in practice we'd have to make orphan instances an error, unless either
> >the type or the class is in the current package.
> 
> No rule of the PVP is currently enforced by the compiler, so why
> should orphan instances be an error? GHC warns about them, for me
> this is enough.

Like I said, I don't think a "no orphan instances in anything you
transitively depend on" rule will work in practice if there is nothing
to stop people from putting orphan instances in libraries.


Thanks
Ian




More information about the Libraries mailing list