BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

Handle pretty and base <> collision #227

Closed AndreasLoow closed 6 years ago

AndreasLoow commented 6 years ago

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 commented 6 years ago

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

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

andreasabel commented 6 years ago

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

AndreasLoow commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

The third attempt seems to work!

SantiMunin commented 6 years ago

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

AndreasLoow commented 6 years ago

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 commented 6 years ago

Yep.

I just used ghc-8.2.2 to install it. Thanks

On Sat, 9 Jun 2018 at 12:06, Andreas Lööw notifications@github.com wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BNFC/bnfc/pull/227#issuecomment-395956977, or mute the thread https://github.com/notifications/unsubscribe-auth/ABS_IxYpGueYo6nD-dIhORSTtunYYEqbks5t654sgaJpZM4S7PIB .