Relaxin the PVP with regards to adding instances

Johan Tibell johan.tibell at gmail.com
Thu Sep 6 18:19:04 CEST 2012


On Wed, Sep 5, 2012 at 5:22 PM, Evan Laforge <qdunkan at gmail.com> wrote:
>> Assuming no one uses orphan instances, adding instances is always safe
>> because you can only add instances for types from packages you depend
>> on, which means that they can't be depending on your package in turn
>> and have defined a non-orphan instance for a type or class defined in
>> your package.
>
> The thing is if a library is missing some standard instance like
> Monoid it's very tempting to put in your own.  So the instances the
> library author is most likely to eventually add in are also the ones
> people are most likely to have worked around locally by adding their
> own orphans.
>
> E.g. Applicative for Parsec, Monoid for Text.PrettyPrint.Doc.

In this case I would add a newtype wrapper. I've been doing that
lately and it doesn't add much noise.

-- Johan



More information about the Libraries mailing list