Let's say I have libfoo. It depends on libbar. In accordance with the Package Versioning Policy, I specify
libbar ==0.1.*
in the Build-depends: in my cabal file.
Then the developer of libbar releases a new version, 0.2. I test it and there are no changes that affect libfoo. So I change my Build-depends to
libbar ==0.2.*
or perhaps to
libbar >= 0.1 && < 0.3
though I can think of reasons not to do it the latter way. This is the only change I make to libfoo.
libfoo exports functions that accept types defined in libbar and return types defined in libbar. However the change to libbar does not affect any of these functions.
The first version of libfoo is 0.1.0.0. What version number should the second release of libfoo have?
It depends on what you re-export from libbar.
Unlikely, but....
Given that libbar has changed its major number from 0.1 to 0.2, there's something that could break code in the change, and if you reexport it wholesale your major number has to change too: 0.2.0.0
This is the one to watch out for.
There's no way for you to stop instances leaking across module boundaries, and new instances can break existing code. That's why the versioning policy says
Note that modifying imports or depending on a newer version of another package may cause extra instances to be exported and thus force a major version change.
If there are new instances in libbar 2.0, you have to have a new major version: 0.2.0.0.
In this case your code doesn't change. Point 2 of the package versioning policy does not apply:
- Otherwise, if only new bindings, types, classes or modules (but see below) were added to the interface, then A.B may remain the same but the new C must be greater than the old C.
An underlying principle is:
A.B.C uniquely identifies the API.
You didn't add anything or change anything that's exported, so you don't need to change major minor number from 0.1.0, but should change the last part: 0.1.0.1 is right.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With