Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell package versioning policy - changes in dependencies

Tags:

haskell

cabal

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?

like image 641
Omari Norman Avatar asked May 30 '13 02:05

Omari Norman


1 Answers

It depends on what you re-export from libbar.

Do you re-export 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

Does libbar 0.2 declare new instances?

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.

Otherwise

In this case your code doesn't change. Point 2 of the package versioning policy does not apply:

  1. 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.

like image 65
AndrewC Avatar answered Oct 21 '22 06:10

AndrewC