ekmett/contravariant

Revision update broke our freeze file

hasufell opened this issue · 4 comments

https://hackage.haskell.org/package/contravariant-1.5.1/revisions/

The downgrade of StateVar upper bound broke our freeze file. I think these kind of updates should be avoided at all cost. Why was this even done? It built fine before this revision.

It wasn't a downgrade—I reverted an incorrect version bump on the upper version bounds of StateVar.

If you look at revision 1, you'll notice that contravariant-1.5.1 was originally released with StateVar < 1.2 version bounds. When StateVar-1.2 was released, I mistakenly believed that I could simply bump these upper version bounds to < 1.3, as there didn't appear to be any changes in StateVar-1.2 that would affect contravariant. However, when I actually did bump these version bounds, I discovered that contravariant fails to build with StateVar-1.2 on old GHCs due to changes in Safe Haskell behavior. See here for an example of the error that occurred.

In light of this, I decided to revert my mistaken revision and release contravariant-1.5.2, which accommodates the Safe Haskell changes in StateVar-1.2 properly. I apologize for the confusion on this matter, but there was a good reason for doing this.

As far as why the freeze file itself broke due to this revision, I'm inclined to believe that this is a cabal issue. Talking with people more knowledgeable than I on the #haskell IRC channel pointed me in the direction of haskell/cabal#3502, which suggests that cabal new-freeze's constraints aren't yet expressive enough to capture all of the inputs that uniquely determine a build plan (including Hackage revision information).

In any case, there's really nothing more that can be done on contravariant's side, so I'm going to close this. Please feel free to re-open if you disagree.

hvr commented

Fwiw, when using freeze files, the documentation hints at it that you really want to combine this with the index-state: feature; see https://cabal.readthedocs.io/en/latest/nix-local-build.html#cfg-field-index-state

This allows to change the source package index state the solver uses to compute install-plans. This is particularly useful in combination with freeze-files in order to also freeze the state the package index was in at the time the install-plan was frozen.

Fwiw, an alternative hack is to use

allow-newer: *:*
allow-older: *:*

but I'd strongly suggest to use the index-state: approach instead.

Thanks for the tip, @hvr! Out of curiosity, can this index-state information be inserted into the .freeze file itself, or can it only be specified separately (e.g., in a cabal.project file)?