yav / pretty-show

Tools for working with derived Show instances in Haskell.
MIT License
57 stars 15 forks source link

the hackage package won't build with GHC 7.7 #8

Closed Mikolaj closed 10 years ago

Mikolaj commented 10 years ago

GHC 7.7 does not accept the code generated from the old happy and the latest package on hackage contains the generated happy code (apparently it's a tarred package dir, not the result of 'cabal sdist'). I understand it allows the package to be compiled on machines without happy, but unfortunately it's not forward-compatible.

yav commented 10 years ago

Hi, It looks like this is due to a bug in Cabal: if you have built the package, and then you say cabal sdist, the tarball also ends up containing the generated parser. I've uploaded a new version to hackage (1.6.2) to fix this. Could you please try it out, and let me know if it works OK with HEAD---I don't have it installed at the moment.

Mikolaj commented 10 years ago

Thank you very much, it compiles OK with HEAD now.

dcoutts commented 10 years ago

@yav FYI, the cabal behaviour is by design. It will include machine-independent pre-processor output by default (in line with standard practice from automake/autoconf systems). If you do a clean before cabal sdist then it warns that it cannot include pre-processor output.

This (happy 1.19 + ghc-7.8) is the first time I think that we've had the problem of old generated code not working with a new compiler. We'll have to ponder it.

Mikolaj commented 10 years ago

A related issue right now is that pretty-show-1.6.2 does not compile on travis: https://github.com/travis-ci/travis-ci/issues/1695#issuecomment-30137015. I ended up constraining pretty-show to 1.6.1 in my private project, after all, so that it can be compiled straight from hackage (without installing a new 'happy' first --- assuming the user has the old, stock 'happy'). Ideally, we should include the pre-processor output (in case there's no proper version of the tool on the target machine), but automatically regenerate it if GHC complains.

Mikolaj commented 10 years ago

@yav: FYI: version 1.6.3 builds fine on my GHC-7.7, but fails on my GHC-7.4.2 with

~/r/LambdaHack$ cabal install pretty-show
Resolving dependencies...
Downloading pretty-show-1.6.3...
Configuring pretty-show-1.6.3...
cabal: The program happy version >=1.19 is required but the version found at
/usr/bin/happy is version 1.18.9
Failed to install pretty-show-1.6.3
cabal: Error: some packages failed to install:
pretty-show-1.6.3 failed during the configure step. The exception was:
ExitFailure 1
Mikolaj commented 10 years ago

@yav: BTW

https://github.com/NixOS/nixpkgs/commit/367b119971fad6314b642c41e8ea6d9216439b85#commitcomment-4907478

so, apparently, your last approach is the right thing to do, given the limitations of the tools.