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

Autogenerated "Paths_" does not build in the presence of OverloadedStrings and RebindableSyntax #3789

Closed
rohit507 opened this issue Jan 18, 2018 · 5 comments · Fixed by haskell/cabal#5054

Comments

@rohit507
Copy link

rohit507 commented Jan 18, 2018

General summary/comments (optional)

It looks like some combination of Hpack, OverloadedLists, OverloadedString, and RebindableSyntax results in the generation of an invalid "Paths_*" module for the project. In particular, it doesn't import GHC.Exts to compensate for the lack of "fromListN" and "fromString" within scope.

I'm not sure whether this is an issue with stack or cabal's "Distribution.Simple.defaultMain" so I'm asking here first.

Steps to reproduce

Basic: stack build within the attached example project.

Suspected:

  1. Have a project where hpack adds the autogenerated "paths_" to the cabal file (I'm not clear on the condition needed for this)
  2. Ensure you have OverloadedStrings and RebindableSyntax extensions enabled.
  3. Have an exported module.
  4. Build the package.

Expected

Build Succeeds

Actual

Trimmed output below, full output at http://lpaste.net/361747

$ stack build edg-prelude
edg-prelude-0.1.0.0: build (lib)
Preprocessing library for edg-prelude-0.1.0.0..
Building library for edg-prelude-0.1.0.0..
[2 of 2] Compiling Paths_edg_prelude ( .stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0/build/autogen/Paths_edg_prelude.hs, .stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0/build/Paths_edg_prelude.o )

/home/rkr/Workspace/edg-1.5/edg-prelude/.stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0/build/autogen/Paths_edg_prelude.hs:29:19: error:
    Not in scope: ‘fromListN’
   |
29 | version = Version [0,1,0,0] []
   |                   ^^^^^^^^^

{.. snip ..}

/home/rkr/Workspace/edg-1.5/edg-prelude/.stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0/build/autogen/Paths_edg_prelude.hs:50:18: error:
    Not in scope: ‘fromString’
    Perhaps you meant ‘showString’ (imported from Prelude)
   |
50 |   return (dir ++ "/" ++ name)
   |                  ^^^


--  While building custom Setup.hs for package edg-prelude-0.1.0.0 using:
      /home/rkr/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0 build lib:edg-prelude --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Stack version

$ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0

Method of installation

  • curl -sSL https://get.haskellstack.org/ | sh with a recent stack upgrade

@mgsloan
Copy link
Contributor

mgsloan commented Jan 18, 2018

See sol/hpack#195 for why Paths_ is added.

This is an upstream Cabal issue, I am working on a fix.

For now, and probably for a year or two, just don't include those in default-extensions.

@rohit507
Copy link
Author

Should I make an issue for cabal?

@mgsloan
Copy link
Contributor

mgsloan commented Jan 18, 2018

@rohit507 That's ok, I fixed it here: haskell/cabal#5054

@rohit507
Copy link
Author

Brilliant, thank you. Do you have any idea when this would end up in a release?

@mgsloan
Copy link
Contributor

mgsloan commented Jan 18, 2018

Good question, not sure!

phadej added a commit to phadej/cabal that referenced this issue Feb 1, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.
phadej added a commit to phadej/cabal that referenced this issue Feb 1, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to phadej/cabal that referenced this issue Feb 1, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to phadej/cabal that referenced this issue Feb 1, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to phadej/cabal that referenced this issue Feb 1, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to phadej/cabal that referenced this issue Feb 2, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to phadej/cabal that referenced this issue Feb 2, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to phadej/cabal that referenced this issue Feb 2, 2018
Fixes haskell#5086

The haskell#5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
phadej added a commit to haskell/cabal that referenced this issue Feb 2, 2018
Fixes #5086

The #5054 links to
commercialhaskell/stack#3789 which says

- `Ensure you have OverloadedStrings and RebindableSyntax extensions
  enabled.`

So we warn only in that case. Only `OverloadeStrings` (or
`OverloadedLists`) or `RebindableSyntax` seems to be ok.

Also make `allBuildInfos` return all (not only buildable) build infos,
removing FIXME. `allBuildInfos` is used only in D.PD.Check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants