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

(#1053) Fix compilation with ghc 8.6.5 #1053

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

hamishmack
Copy link
Collaborator

This change fixes the following errors when building with GHC 8.6.5

[51 of 52] Compiling Nix.Reduce       ( src/Nix/Reduce.hs, /Users/hamish/iohk/hnix/dist-newstyle/build/x86_64-osx/ghc-8.6.5/hnix-0.16.0/build/Nix/Reduce.o )

src/Nix/Reduce.hs:98:18: error:
    Ambiguous occurrence ‘putStrLn’
    It could refer to either ‘Nix.Prelude.putStrLn’,
                             imported from ‘Nix.Prelude’ at src/Nix/Reduce.hs:23:1-28
                             (and originally defined in ‘Relude.Lifted.Terminal’)
                          or ‘Prelude.putStrLn’,
                             imported from ‘Prelude’ at src/Nix/Reduce.hs:26:1-56
                             (and originally defined in ‘System.IO’)
   |
98 |         liftIO $ putStrLn $ "Importing file " <> coerce path''
   |                  ^^^^^^^^

src/Nix/Reduce.hs:102:48: error:
    Ambiguous occurrence ‘show’
    It could refer to either ‘Nix.Prelude.show’,
                             imported from ‘Nix.Prelude’ at src/Nix/Reduce.hs:23:1-28
                             (and originally defined in ‘Relude.String.Conversion’)
                          or ‘Text.Show.show’,
                             imported from ‘Prelude’ at src/Nix/Reduce.hs:26:1-56
                             (and originally defined in ‘GHC.Show’)
    |
102 |           (\ err -> fail $ "Parse failed: " <> show err)
    |                                                ^^^^

src/Nix/Reduce.hs:343:28: error:
    Ambiguous occurrence ‘show’
    It could refer to either ‘Nix.Prelude.show’,
                             imported from ‘Nix.Prelude’ at src/Nix/Reduce.hs:23:1-28
                             (and originally defined in ‘Relude.String.Conversion’)
                          or ‘Text.Show.show’,
                             imported from ‘Prelude’ at src/Nix/Reduce.hs:26:1-56
                             (and originally defined in ‘GHC.Show’)

One way to reproduce this issue is with the haskell.nix hix tool:

You can install hix with:

nix-env -iA hix -f https://github.com/input-output-hk/haskell.nix/tarball/master

Then run this to run cabal build in a nix-shell:

hix-shell --argstr compiler-nix-name ghc865 --argstr configureArgs '--disable-benchmarks' --run 'cabal build lib:hnix'

If you are on an M1 Mac you will need to pass --system x86_64-darwin as well (ghc 8.6.5 does not work on aarch64-darwin).

hamishmack added a commit to input-output-hk/haskell.nix that referenced this pull request Feb 9, 2022
@Anton-Latukha
Copy link
Collaborator

Because of the 3 major versions policy, the GHC 8.6.5 was really hanging by the thread. I kept it in the code for the release and currently, but the check from the CI was removed to follow the policy.

From the PR it is self-evident that GHC 8.6.5 support seems to be still in use.

What would be the short description of its use and how long that is?

@Anton-Latukha Anton-Latukha changed the title Fix for compilation with ghc 8.6.5 (#1053) Fix compilation with ghc 8.6.5 Feb 9, 2022
@Anton-Latukha Anton-Latukha merged commit 7bdad43 into haskell-nix:master Feb 9, 2022
@hamishmack
Copy link
Collaborator Author

Haskell.nix still supports ghc 8.6.5. It would be possible to treat ghc 8.6.5 as a special case and use an older version of hnix with it, but it is nicer if all the compilers work the same. In particular it is nice to be able to build the latest nix-tools (programs Haskell.nix uses to generate nix) with ghc 8.6.5.

@Anton-Latukha
Copy link
Collaborator

Remember we were talking about some haskell.nix supporting questions several years ago.
Well, as I'd been glad to have projects "post-MonadFail", currently supporting GHC 8.6 is not such a big deal. Thankfully project stack does not depend on GHC API changes (as HLS for example).
Defacto extending the support should be Ok.

Since haskell.nix keeps appearing, I think that addendum of project stack to try to include haskell.nix support should be enough.

nix-tools idea does seem interesting. I hope eventually IOHK or somebody would get the Cabal -> Nix design right, which it is - I have ideas, but everyone does & it is a lot of work, IOHK projects seem to be in the ballpark of the right approach.

Hoping that IOHK found the Nix tooling engineer to continue work in this direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants