osa1 feed

Dependency boundaries and orphan instances

June 13, 2014 - Tagged as: haskell, en.

According to the PVP(Package Versioning Policy), adding a non-orphan instance is not a breaking change and a minor version number should be bumped(C in A.B.C) in case of a non-orphan instance implementation.

This means that if you’re implementing an orphan instance, you should specify minor upper bound of the package that defines the typeclass. Otherwise if the package implements the typeclass for the type in the future, you’re package will be broken.

I want to add StackValue a => StackValue [a] instance in hslua, but that breaks Pandoc because it implements that instance without using a newtype(an orphan instance) and hslua dependency upper bound is specified as < 0.4.

Good news is that bergmark at Freenode #haskell told me that now it’s possible to change dependency ranges on Hackage without pushing a new version, so there’s an easy fix that’ll keep package working.