Kleidukos / print-api

Dump the declarations of Haskell modules
11 stars 1 forks source link

`print-api` somtimes get confused about GHC version #17

Open mmhat opened 3 months ago

mmhat commented 3 months ago

I am trying to use print-api in a new project of mine: https://github.com/mmhat/os-string-aeson I have GHC 9.10.1 set as the default compiler, but use GHC 9.8.2 in that project (specified in the cabal.project.local). I did the following:

$ cabal exec -v0 -- ghc --numeric-version
9.8.2

$ gh release download --repo Kleidukos/print-api --pattern 'print-api-*-Linux-static-9.8.2-x86_64.tar.gz' --output - | tar -xz
$ ls -l print-api
-rwxr-xr-x 1 user users 20M Jul 21 22:11 print-api

$ cabal build all
Resolving dependencies...
Up to date

$ ./print-api --package-name os-string-aeson
print-api: cannot satisfy -package os-string-aeson
    (use -v for more information)

$ cabal exec -- ./print-api --package-name os-string-aeson
Detected GHC version: 9.10.1
`print-api-9.10.1 --package-name os-string-aeson` exited with error code 1
print-api: print-api-9.10.1: cannot satisfy -package os-string-aeson:
    os-string-aeson-1.0.0-inplace is unusable due to missing dependencies:
      aeson-2.2.3.0-7a106f1dec85cddc87a4c1b249b4567a94ba581d16463b2e9e7d1107e35ba863 base-4.19.1.0-9254 os-string-2.0.6-b4690b41af649eb7303fdf67c045693233c019bab95ecc69e7be85760cab6f74 os-string-aeson-1.0.0-inplace-os-string-aeson-internal
    os-string-aeson-1.0.0-inplace-os-string-aeson-internal is unusable due to missing dependencies:
      aeson-2.2.3.0-7a106f1dec85cddc87a4c1b249b4567a94ba581d16463b2e9e7d1107e35ba863 base-4.19.1.0-9254 base64-1.0-edf9b47d230d327e5c6f2811aca48d892a21b4de414804fb610d6cf811abe447 bytestring-0.12.1.0-c2a9 exceptions-0.10.7-e073 os-string-2.0.6-b4690b41af649eb7303fdf67c045693233c019bab95ecc69e7be85760cab6f74 text-2.1.1-99fd text-short-0.1.6-749a38e0292a60daf78e8b5ea451a1bbc38ea4cc5ac774349a6a674379556bd8
    (use -v for more information)
HasCallStack backtrace:
  finally, called at compiler/GHC/Utils/Panic.hs:303:7 in ghc-9.10.1-7767:GHC.Utils.Panic

CallStack (from HasCallStack):
  error, called at src/PrintApi/Utils.hs:51:7 in print-api-0.1.0.1-6bc1219cc4bca43af325c2d545e601067c0ec7730c8d1e9dad0e5a3da6596d93:PrintApi.Utils

$ ghcup --offline run --ghc 9.8.2 -- ./print-api --package-name os-string-aeson
print-api: cannot satisfy -package os-string-aeson
    (use -v for more information)

$ ghcup --offline run --ghc 9.8.2 -- cabal exec -- ./print-api --package-name os-string-aeson

The last command worked, but I think the user experience could be better...

Kleidukos commented 3 months ago

What is the default GHC version that you have in your shell?

mmhat commented 3 months ago

What is the default GHC version that you have in your shell?

Oh, I forgot to mention that in the issue: It's GHC 9.10.1.

Kleidukos commented 3 months ago

Haha yeah I am not surprised this would confuse it. Yeah we have to work on the ergonomics of the tool.