How to deal with upstream version bounds changes when uploading/updating a package on Hackage? (And why don't I get the same errors on my machine?)
Asked Answered
S

0

0

Some time ago I worked on this project, and I experimented a bit with package candidates.

Then, yesterday, I uploaded the real package on hackage. However, it fails to build. I think the reason is simply that version requirements of my dependencies changed since I stopped working on the project. Indeed, when I read this part of the error,

[__1] next goal: transformers (dependency of xnobar)
[__1] rejecting: transformers-0.6.1.0/installed-0.6.1.0 (conflict: xnobar =>
transformers>=0.5.6 && <0.6)
[__1] skipping: transformers-0.6.1.1, transformers-0.6.1.0,
transformers-0.6.0.6, transformers-0.6.0.2 (has the same characteristics that
caused the previous version to fail: excluded by constraint '>=0.5.6 && <0.6'
from 'xnobar')
[__1] trying: transformers-0.5.6.2
[__2] trying: dbus-1.3.6 (dependency of xnobar)
[__3] trying: lens-5.3.2 (dependency of dbus)
[__4] next goal: semigroupoids (dependency of lens)
[__4] rejecting: semigroupoids-6.0.1 (conflict: transformers==0.5.6.2,
semigroupoids => transformers>=0.6.1.0 && <0.7)

my understanding is as follows:

  • several versions (the non deprecated ones) of transformers were discarded, going from most recent 0.6.1.1 down to 0.6.0.2, and finally 0.5.6.2 was picked up as it is within the bounds I have in my .cabal file, i.e. transformers >=0.5.6 && <0.6;
  • dbus, however, whose most recent version is still within the >= 1.3.5 && < 1.4 constraint I had set initially, now seems to be indirectly (via lens and semigroupoids, which I don't directly depend on, so I don't have bounds set for them) requiring transformers>=0.6.1.0 && <0.7, which is clearly in conflict with the version bounds in my .cabal (see previous bullet point).

... And something similar happens for other parts of my deps.

Now, If I look at the whole error message, I can certainly come up with working bounds, and be happy with it.

However, I'd like to understand what is the "proper" way to address this type of issue, i.e. what to do with version bounds, when one wants to upload a new version of a package.

Besides, what is making this a bit more difficult, is that the package builds fine on my machine! I guess that means that my Haskell setup is too old with respect to what Hackage uses? I'm pretty sure I've recently run cabal update... Maybe that's not enough? Here's what GHCup tells me:

┌──────────────────────────────────GHCup──────────────────────────────────┐
│    Tool  Version         Tags                          Notes            │
│─────────────────────────────────────────────────────────────────────────│
│✔✔  GHCup 0.1.30.0   latest,recommended                                  │
│─────────────────────────────────────────────────────────────────────────│
│✗   Stack 2.15.7     latest                                              │
│✗   Stack 2.15.5     recommended                                         │
│✗   Stack 2.15.3                                                         │
│─────────────────────────────────────────────────────────────────────────│
│✗   HLS   2.9.0.1    latest                                              │
│✗   HLS   2.9.0.0                                                        │
│✗   HLS   2.8.0.0                                                        │
│✔✔  HLS   2.7.0.0    recommended                                         │
│✗   HLS   2.6.0.0                                                        │
│─────────────────────────────────────────────────────────────────────────│
│✗   cabal 3.12.1.0   latest                                              │
│✔✔  cabal 3.10.3.0   recommended                                         │
│✗   cabal 3.6.2.0-p1                                                     │
│─────────────────────────────────────────────────────────────────────────│
│✗   GHC   9.10.1     latest,base-4.20.0.0                                │
│✗   GHC   9.8.2      base-4.19.1.0                 hls-powered,2024-02-23│
│✗   GHC   9.6.6      base-4.18.2.1                                       │
│✗   GHC   9.6.5      base-4.18.2.1                                       │
│✔✔  GHC   9.4.8      recommended,base-4.17.2.1     hls-powered           │
│✗   GHC   9.2.8      base-4.16.4.0                 hls-powered           │
│✗   GHC   9.0.2      base-4.15.1.0                                       │
│✗   GHC   8.10.7     base-4.14.3.0                                       │
│✗   GHC   8.8.4      base-4.13.0.0                                       │
│✗   GHC   8.6.5      base-4.12.0.0                                       │
│✗   GHC   8.4.4      base-4.11.1.0                                       │
└─────────────────────────────────────────────────────────────────────────┘
Shankle answered 28/7, 2024 at 6:37 Comment(4)
The most likely explanation for the discrepancy between building on your machine and not building on Hackage is the GHC version mismatch (9.4.8 on your machine, 9.6.3 on Hackage). This affects which version of base is available, which can have pretty arbitrary, unpredictable downstream effects on version selection.Justino
@DanielWagner, but 9.6.3 is not even in the list of the alternatives in GHCup. I suppose I could try the closest version on either side hoping that at least in one of the two cases I manage get something to build on hackage. Or do you have better suggestions?Shankle
If you hit a to "Show all versions", does that get you 9.6.3?Roehm
@JosephSible-ReinstateMonica, yes, it does. I didn't know of this command. As much as it is written on the bottom, I see now.Shankle

© 2022 - 2025 — McMap. All rights reserved.