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

Add support for GHC 9.10. #74

Merged
merged 7 commits into from
May 20, 2024
Merged

Conversation

jonathanknowles
Copy link
Contributor

@jonathanknowles jonathanknowles commented May 20, 2024

This PR adds support for GHC 9.10 and base version 4.20.0.0.

This commit fixes a build failure that occurs when compiling with GHC
version `>= 9.10` and base version `>= 4.20.0.0`:

```
[1 of 2] Compiling Codec.Binary.Bech32.Internal
src/Codec/Binary/Bech32/Internal.hs:93:1: error: [GHC-66111]
    The import of ‘Data.Foldable’ is redundant
      except perhaps to import instances from ‘Data.Foldable’
    To import instances alone, use: import Data.Foldable()
   |
93 | import Data.Foldable
   | ^^^^^^^^^^^^^^^^^^^^...
```

Related issue:
haskell/core-libraries-committee#167
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/support-ghc-9.10 branch 2 times, most recently from c05b98e to 2eb9c30 Compare May 20, 2024 02:23
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/support-ghc-9.10 branch 2 times, most recently from 3014c17 to 26a1802 Compare May 20, 2024 02:41
@jonathanknowles jonathanknowles self-assigned this May 20, 2024
@@ -72,40 +72,73 @@ module Codec.Binary.Bech32.Internal

) where

import Prelude
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really think it is good idea?

Copy link
Contributor Author

@jonathanknowles jonathanknowles May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paweljakubas

The release of GHC 9.10.1 made the following change to base:

This leads to the following build failure, when compiled with GHC 9.10.1:

[1 of 2] Compiling Codec.Binary.Bech32.Internal
src/Codec/Binary/Bech32/Internal.hs:93:1: error: [GHC-66111]
    The import of ‘Data.Foldable’ is redundant
      except perhaps to import instances from ‘Data.Foldable’
    To import instances alone, use: import Data.Foldable()
   |
93 | import Data.Foldable
   | ^^^^^^^^^^^^^^^^^^^^...

The error occurs because foldl' is now imported both by Data.Foldable and by Prelude.

Supposing that we only had to support GHC ≥ 9.10, then we could use either of the following solutions:

  • hide foldl' with import Prelude hiding (foldl')
  • remove the redundant import Data.Foldable (foldl')

However, both of these solutions will lead to compile errors on GHC < 9.10, which we still have to support.

The solution used by this PR is to replace all implicit imports with explicit imports: this should guarantee we import exactly the same set of symbols across different GHC versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paweljakubas Here's a similar change made in another library: blamario/monoid-subclasses@de06735

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation! very unfortunate change I must say ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation! very unfortunate change I must say ....

Yeah, I'm guessing it caused headaches for a few people!

On the bright side though, we now have foldl' in Prelude. 😄

Copy link
Contributor

@paweljakubas paweljakubas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@jonathanknowles jonathanknowles force-pushed the jonathanknowles/support-ghc-9.10 branch from 34367af to 4527f06 Compare May 20, 2024 07:38
@jonathanknowles jonathanknowles added this pull request to the merge queue May 20, 2024
Merged via the queue into master with commit 5a42857 May 20, 2024
21 checks passed
@jonathanknowles jonathanknowles deleted the jonathanknowles/support-ghc-9.10 branch May 20, 2024 11:53
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.

3 participants