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

cabal install policeman fails using cabal version 3.6 #65

Closed
jneira opened this issue Sep 13, 2021 · 4 comments
Closed

cabal install policeman fails using cabal version 3.6 #65

jneira opened this issue Sep 13, 2021 · 4 comments
Labels
question Further information is requested

Comments

@jneira
Copy link

jneira commented Sep 13, 2021

  • Hi, i've just tried to install policeman with cabal --store-dir=path/to/fresh/store install policeman -w ghc-8.8.4 and it failed using my recently installed cabal-install-3.6.0.0 with:
Installing library in D:\cabal\store\ghc-8.8.4\incoming\new-15164\cabal\store\ghc-8.8.4\relude-0.6.0.0-68df4281a545941c3074b5adeb0c0bf13b9935a2\lib
Configuring library for policeman-0.0.0.0..
Preprocessing library for policeman-0.0.0.0..
Building library for policeman-0.0.0.0..
[ 1 of 15] Compiling Paths_policeman

dist\build\autogen\Paths_policeman.hs:66:22: error:
    * 'last' works with 'NonEmpty', not ordinary lists.
      Possible fix:
          Replace: [Char]
          With:    NonEmpty Char

      However, you can use 'last' with the ordinary lists.
      Apply 'viaNonEmpty' function from relude:
          viaNonEmpty last (yourList)
      Note, that this will return 'Maybe Char'
      therefore it is a safe function unlike 'last' from the standard Prelude
    * In the first argument of `isPathSeparator', namely `(last dir)'
      In the expression: isPathSeparator (last dir)
      In a stmt of a pattern guard for
                     an equation for `joinFileName':
        isPathSeparator (last dir)
   |
66 |   | isPathSeparator (last dir) = dir ++ fname
   |                      ^^^^^^^^
cabal-3.6.0.0.exe: Failed to build policeman-0.0.0.0 (which is required by
exe:policeman from policeman-0.0.0.0).
  • cabal-3.4.0.0 install policeman -w ghc-8.8.4 works and after that, cabal-3.6.0.0 also works so you need a fresh store dir to reproduce
@Mikolaj
Copy link

Mikolaj commented Sep 13, 2021

It seems the breakage stems from the use of last in Paths_ and the fact that Prelude is replaced in policeman. We (the cabal project) would welcome a PR that changes Paths_ to use the standard Prelude regardless which method is used to overwrite it (see https://hackage.haskell.org/package/relude for a few methods). For now, we don't see an easy workaround, except a rather crude one, namely using NoImplicitPrelude in each non-autogenerated file as the way to replace Prelude. Let us know how we can help.

Edit: PR with tests so that the breakage is caught before cabal release.

@Mikolaj
Copy link

Mikolaj commented Sep 14, 2021

See also the approach from haskell/cabal#7646 (not using Prelude at all in Paths_), which seems easier to do and test.

@amesgen
Copy link

amesgen commented Sep 14, 2021

I also stumbled upon this issue with cabal 3.6, and FTR, another workaround when using the Paths_ module for the version number is to use the CPP variable CURRENT_PACKAGE_VERSION which has been available since cabal 2.0: https://cabal.readthedocs.io/en/3.6/cabal-package.html?highlight=CURRENT_PACKAGE_VERSION#conditional-compilation

srid added a commit to srid/emanote that referenced this issue Sep 24, 2021
Drop implicit prelude because of kowainik/policeman#65

New nixpkgs appears to have broke HLS in vscode, but whatever.
@chshersh chshersh added the question Further information is requested label Oct 9, 2021
@chshersh
Copy link
Contributor

chshersh commented Oct 9, 2021

policeman now builds with cabal-install-3.6.2.0 after the corresponding cabal issue was resolved. So I'm closing this one.

Thanks, @alexbiehl and the Cabal team for fixing the problem!

@chshersh chshersh closed this as completed Oct 9, 2021
srid added a commit to srid/heist-extra that referenced this issue Sep 23, 2022
Drop implicit prelude because of kowainik/policeman#65

New nixpkgs appears to have broke HLS in vscode, but whatever.
shivaraj-bh pushed a commit to shivaraj-bh/emanote that referenced this issue Dec 18, 2023
Drop implicit prelude because of kowainik/policeman#65

New nixpkgs appears to have broke HLS in vscode, but whatever.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants