Should the PVP be changed with regards to instances?

John Lato jwlato at gmail.com
Wed Dec 21 14:19:43 CET 2011


On Wed, Dec 21, 2011 at 11:26 AM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
>
> On Wed, 21 Dec 2011, John Lato wrote:
>
>> On Wed, Dec 21, 2011 at 11:16 AM, Henning Thielemann
>> <lemming at henning-thielemann.de> wrote:
>>>
>>>
>>> On Wed, 21 Dec 2011, John Lato wrote:
>>>
>>>> I'm in the same situation, however I'm quite hesitant to add new
>>>> instances in a minor version.  Adding new dependencies can cause
>>>> breakage even without orphan instances, if downstream packages import
>>>> a different version of that dependency already.
>>>
>>>
>>>
>>> The proposal was about adding type class instances, not about adding
>>> package
>>> dependencies.
>>
>>
>> IME, new type class instances usually arise only because of new
>> package dependencies or a major version bump to an existing
>> dependency, either of which would currently require a major bump.
>
>
> Adding a package dependency does not require a minor version bump.
> Increasing the imported version of a package dependency only requires a
> version bump if that changes the API. Thus I do not see a closer connection
> between adding instances and modifying package dependencies.
>

I'm not sure exactly what you mean here.  I suspect it's either:

  1.  The discussion is about adding new instances only, there's no
need to add new package dependencies.
  2.  Modifying package dependencies is orthogonal to adding instances
to a package.

If 1, I agree it's possible to add a new instance that was previously
undeclared.  I just think that's much less likely than wanting to add
an instance for a class from a new package.

If 2, you're correct in a limited sense.  But any time you add a new
package dependency you transitively get all of its instances.  While
this may not necessarily add new instances to your package, it
certainly has the potential to do so.  Besides, I was considering the
case of modifying package dependencies specifically to change the API
(via new instances).

Do you check for new instances every time you add a new dependency to
a package?  If not, how do you know that the API hasn't changed?

Also consider that instances can be written with type variables.  This
can lead to overlapping instances (breaking compilation) without
involving orphans or otherwise dodgy code.

Personally, I think that the overhead necessary to use the PVP with
type classes and instances is far too high, however it's the way it is
for good reasons.  Relaxing this requirement will almost certainly
lead to increased clashes, albeit perhaps only a marginal increase.



More information about the Libraries mailing list