commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
4k stars 843 forks source link

Warn when upgrading base #3940

Closed snoyberg closed 6 years ago

snoyberg commented 6 years ago

I've seen users get confusing error messages multiple times when trying to upgrade base, often from trying to install a package like ghc-mod. We should give a warning in such situations, and recommend changing GHC versions instead.

SkyWriter commented 6 years ago

@snoyberg , it may sound silly, but I don't suppose you could drop a few lines on how to produce an erroneous case? I'm willing to attack this, but seem to be stuck understanding the actual issue. Thanks!

snoyberg commented 6 years ago

Great question. I'm not sure how the original people suffering from this triggered the bug, but here's an example of steps that could be taken:

  1. Create a stack.yaml specifying lts-11.4, e.g.

    resolver: lts-11.4
    packages: []
  2. Try to build ghc-mod, e.g. stack build ghc-mod

  3. You'll get an error message recommending, among other things, that you upgrade your base version, e.g.:

    - Cabal-1.24.2.0
    - base-4.9.1.0
    - cabal-helper-0.7.3.0
    - extra-1.5.3
    - haskell-src-exts-1.19.1
    - hlint-2.0.15
    - monad-journal-0.7.2
    - optparse-applicative-0.13.2.0
  4. If you try to build anything, you'll keep getting error messages about necessary extra deps.

Ideally, two things should instead happen:

  1. Stack should never recommend adding base to extra-deps
  2. If someone put base in extra-deps, it should give a very loud warning about the fact that you almost certainly didn't mean that.
SkyWriter commented 6 years ago

@snoyberg alright, much clearer now. Especially with the 3907 reference. Thank you! I'll try to get it fixed.

SkyWriter commented 6 years ago

I have submitted my take on implementing the changes. Could someone possibly take a look at the code, and tell me if it's the right direction at all?

snoyberg commented 6 years ago

The PR looks great! I've added a few comments over there, thanks for the contribution.

snoyberg commented 6 years ago

Fixed by #3993, thanks!