Nothing Special   »   [go: up one dir, main page]

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

Handle pretty and base <> collision #227

Merged
merged 2 commits into from
Apr 30, 2018
Merged

Conversation

AndreasLoow
Copy link
Collaborator

Because <> was added to Prelude in base 4.11.0.0 one gets the following error when trying to build BNFC with e.g. GHC 8.4.1:

[10 of 97] Compiling BNFC.PrettyPrint ( src/BNFC/PrettyPrint.hs, dist/build/bnfc/bnfc-tmp/BNFC/PrettyPrint.o )

src/BNFC/PrettyPrint.hs:16:13: error:
    Ambiguous occurrence ‘<>’
    It could refer to either ‘Prelude.<>’,
                             imported from ‘Prelude’ at src/BNFC/PrettyPrint.hs:2:8-23
                             (and originally defined in ‘GHC.Base’)
                          or ‘Text.PrettyPrint.<>’,
                             imported from ‘Text.PrettyPrint’ at src/BNFC/PrettyPrint.hs:10:1-23
                             (and originally defined in ‘Text.PrettyPrint.HughesPJ’)
   |
16 | a <.> b = a <> "." <> b
   |             ^^

src/BNFC/PrettyPrint.hs:16:20: error:
    Ambiguous occurrence ‘<>’
    It could refer to either ‘Prelude.<>’,
                             imported from ‘Prelude’ at src/BNFC/PrettyPrint.hs:2:8-23
                             (and originally defined in ‘GHC.Base’)
                          or ‘Text.PrettyPrint.<>’,
                             imported from ‘Text.PrettyPrint’ at src/BNFC/PrettyPrint.hs:10:1-23
                             (and originally defined in ‘Text.PrettyPrint.HughesPJ’)
   |
16 | a <.> b = a <> "." <> b
   |                    ^^

I'm not sure about the proper way of fixing this, but this PR at least builds on GHC 8.4.1. See also haskell/pretty#30.

@AndreasLoow
Copy link
Collaborator Author
AndreasLoow commented Mar 26, 2018

(Someone might want to add 8.4 to .travis.yml also.)

Edit: Apparently there's no 8.4 version on Travis yet.

@andreasabel
Copy link
Member

Mmh, after pulling your patches, the small test suites fail. (See travis output.)

@AndreasLoow
Copy link
Collaborator Author

LOL, :(. Enabling CPP removes /* these comments */ (but not // these comments) from the test specs. I'm not sure how to solve it, will try to think of something.

@AndreasLoow
Copy link
Collaborator Author

Hmmmmmmm, the new attempt doesn't work either, because of this: https://www.reddit.com/r/haskell/comments/3ryf2p/how_can_you_use_a_custom_prelude_with_ghci/. (The doctests dies when starting GHCI.)

@AndreasLoow
Copy link
Collaborator Author

The third attempt seems to work!

@SantiMunin
Copy link

Is this change available in Hackage? I'm hitting this error (using 8.4.2).

@AndreasLoow
Copy link
Collaborator Author

No it's not (the latest Hackage release seems to be from 2016), as a temporary workaround you can install BNFC from the Git repo instead.

@SantiMunin
Copy link
SantiMunin commented Jun 9, 2018 via email

@andreasabel andreasabel added this to the 2.8.2 milestone Sep 25, 2018
andreasabel added a commit that referenced this pull request Feb 7, 2019
@andreasabel andreasabel linked an issue Oct 7, 2020 that may be closed by this pull request
andreasabel added a commit that referenced this pull request Oct 7, 2020
This makes it easier to load the .hs source files into ghci.
Some LANGUAGE pragmas may be missing still.

Now GHC 7.10 may warn that Prelude does not export (<>), but this is a
minor wart.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

installation script 'cabal install alex happy BNFC' fails on Mac
3 participants