Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better feedback on invalid compiler field WAS Rejects valid compiler field #4877

Open
recursion-ninja opened this issue Jun 17, 2019 · 3 comments

Comments

@recursion-ninja
Copy link

Does not support the following valid compiler value:

compiler: 8.8.0.20190613

Steps to reproduce

Run:

stack build

with this stack.yaml:

allow-newer: true

#compiler: ghc-8.6.5
#compiler: ghc-8.8.1
#compiler: 8.8.1-alpha2
compiler: 8.8.0-20190613

compiler-check: match-exact
resolver: lts

setup-info:
  ghc:
    linux32:
        8.8.0.20190613:
            url: "https://downloads.haskell.org/~ghc/8.8.1-alpha2/ghc-8.8.0.20190613-i386-deb9-linux.tar.xz"
            content-length: 204060792
            sha1: 0fe7fc95073602078e0677ae623dd02f46ae3a5b
            sha256: 77d23afaf035775c99b48f0c78117a8073682dde3c6104b8ced4d5d062287772
    macosx:
        8.8.0.20190613:
            url: "https://downloads.haskell.org/~ghc/8.8.1-alpha2/ghc-8.8.0.20190613-x86_64-apple-darwin.tar.xz"
            content-length: 184846152
            sha1: 116bdaadcde045f78adcf1ffce291c79fb1c3eb6
            sha256: 04b5b4dc35db2bc26f5e4d46946409a5d21f47a7923bf69ee31b093b7e71e889
    linux64:
        8.8.0.20190613:
            url: "https://downloads.haskell.org/~ghc/8.8.1-alpha2/ghc-8.8.0.20190613-x86_64-deb9-linux.tar.xz"
            content-length: 199898532
            sha1: 11360a17f61da02c82d0f64f07e124479cedecc4
            sha256: ff532d0b700fcd9c5343a942eab35450cd9d70ce5c5064ca4dfe7af94b05616e
    linux64-tinfo6:
        8.8.0.20190613:
            url: "https://downloads.haskell.org/~ghc/8.8.1-alpha2/ghc-8.8.0.20190613-x86_64-fedora27-linux.tar.xz"
            content-length: 201560804
            sha1: 07eb8ab473f2aa3c21ac2b497142a01466ace5ee
            sha256: cf972265333244c8648b99fd1bcf90e1a3e7b5335c0a418f6bc9849382de8f48
    windows64:
        8.8.0.20190613:
            url: "https://downloads.haskell.org/~ghc/8.8.1-alpha2/ghc-8.8.0.20190613-x86_64-unknown-mingw32.tar.xz"
            content-length: 224468920
            sha1: b4a3b2b45625eb32dd7f892246da9a602d9ce7db
sha256: 83b4c89d01c711c0f64bcc5abda287678c027b1b0d44ada17036917aeae588eb

Expected

Try to build with the alpha version of GHC 8.8

Actual

Fails to parse with an error message that does not provide the user with the requisite information to correct the issue at hand.

Stack version

Version 2.1.1, Git revision f612ea85316bbc327a64e4ad8d9f0b150dc12d4b (7648 commits) x86_64 hpack-0.31

Method of installation

Don't remember. It was like 3 years and a half dozen upgrades ago.

@recursion-ninja recursion-ninja changed the title Rejects valis compiler feild Rejects valid compiler field Jun 17, 2019
@snoyberg
Copy link
Contributor

That's not a valid field, please try ghc-8.8.0.20190613.

@recursion-ninja
Copy link
Author

recursion-ninja commented Jul 5, 2019

It would be amazing if the parse error, or the documentation that the error directs the user to, actually specifies what a valid field looks like.

The following error message is not informative:

Could not parse '/home/user/project/stack.yaml':
Aeson exception:
Error in $.compiler: failed to parse field 'compiler': Invalid wanted compiler: 8.8.0-20190613
See http://docs.haskellstack.org/en/stable/yaml_configuration/

The description below from the documentation does not provide enough information for the user to understand what is a valid compiler field.

This uses the same syntax as compiler resolvers like ghc-7.10.2 or ghcjs-0.1.0.20150924_ghc-7.10.2

BNF grammar, a regular expression, a plain language description would all be more useful for the user to diagnose the error.

What would be even better, since the list of known compilers is in scope for stack, as is the list of user defined compilers from the setup-info field, the error message should present something like this:

Could not parse '/home/user/project/stack.yaml':
Aeson exception:
Error in $.compiler: failed to parse field 'compiler': Invalid wanted compiler: 8.8.0-20190613
Perhaps you wanted of one:
  [known-ghc]:   ghc-8.0.2
  [known-ghc]:   ghc-8.2.2
  [known-ghc]:   ghc-8.4.4
  [known-ghc]:   ghc-8.6.5
  [setup-info]:  ghc-8.8.0.20190613

@snoyberg
Copy link
Contributor

snoyberg commented Feb 4, 2020

PR certainly welcome to improve error messages.

@snoyberg snoyberg changed the title Rejects valid compiler field Provide better feedback on invalid compiler field WAS Rejects valid compiler field Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants