ghcup-hs
ghcup-hs copied to clipboard
Confusing `ghcup set` error
In GitLab by @callanmcgill on Jul 1, 2021, 24:44
When I run ghcup set
it doesn't seem to be able to find the versions of GHC installed. For example I have the following:
> ghcup install ghc-8.10.4
[ Warn ] This is an old-style command for installing GHC. Use 'ghcup install ghc' instead.
[ Warn ] GHC ver 8.10.4 already installed; if you really want to reinstall it, you may want to run 'ghcup rm ghc 8.10.4' first
> ghcup set ghc-8.10.4
[ Warn ] This is an old-style command for setting GHC. Use 'ghcup set ghc' instead.
[ Error ] The version "ghc-8.10.4" of the tool "GHC" is not installed.
Any ideas what might be causing this? I also find the warnings very confusing since the commands shown are also on the gitlab readme.
In GitLab by @maerwald on Jul 1, 2021, 24:51
ghcup set ghc 8.10.4
The ghc-8.10.4
syntax is not supported. Maybe it could be. But is it worth it?
In GitLab by @callanmcgill on Jul 1, 2021, 24:53
I don't think it should be supported but maybe worth having an error message for it?
I met this when I first time used ghcup set
.
For the command like ghcup set ghc-9.2.8
, should print
Did you mean `ghcup set ghc 9.2.8`?
View all details with `ghcup set --help`
And for the command with definitely invalid params like ghcup set abcd
, should print
Option `abcd` not available.
View all details with `ghcup set --help`
Both of the two should die after printing.
/cc @hasufell make sense?
Sorry, I can't follow. We use optparse-applicative for CLI parsing and as such will get error messages that resemble the parser behavior.
The old parsing is kept for backwards compat. If you have an idea to make the error messages better, please provide a PR.
Sorry I lost some context, but if we don't do modifications for constructors, there wont be a compatible issue right?
The issue here is really that ghc-8.4.4
is a valid version according to the version parser we use: https://hackage.haskell.org/package/versions-6.0.1/docs/Data-Versions.html#t:Versioning
See:
ghci> versioning "ghc-9.2.8"
Right
( General
( Version
{ _vEpoch = Nothing
, _vChunks = Chunks
( Alphanum "ghc" :| [] )
, _vRel = Just
( Release
( Numeric 9 :|
[ Numeric 2
, Numeric 8
]
)
)
, _vMeta = Nothing
}
)
)
This is a feature. Further, we also support installing cross-compilers, e.g. ghcup install ghc javascript-unknown-ghcjs-9.6.2
... so we can't really ignore a foo-
version prefix.
Both of the two should die after printing.
That is not possible, because it will break backwards compat and will render installing cross compilers broken.
We can adjust the warning prints, feel free to open a PR.