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

Compile with GHC8.10.2 #157

Merged
merged 10 commits into from
Aug 26, 2020
Merged

Compile with GHC8.10.2 #157

merged 10 commits into from
Aug 26, 2020

Conversation

nc6
Copy link
Contributor

@nc6 nc6 commented Aug 18, 2020

This PR does not yet update CI to build with GHC 8.10, but makes various changes that bring the code into a place where it compiles with GHC 8.10. As such, downstream libraries may choose to build it with later GHC versions, and it should be easier to move to 8.10 when we decide to make the switch.

@nc6 nc6 requested a review from newhoggy August 18, 2020 13:21
@mrBliss
Copy link
Contributor

mrBliss commented Aug 20, 2020

It seems that the build failed while compiling GHC itself on x86_64-w64-mingw32 🙁

@nc6
Copy link
Contributor Author

nc6 commented Aug 20, 2020

And a strange error about no HasResolution in the cardano-binary tests.

@@ -84,7 +84,7 @@ roundTripRatioBi =
roundTripNanoBi :: Property
roundTripNanoBi = eachOf
1000
(MkFixed @E9 <$> Gen.integral (Range.constantFrom 0 (-1e12) 1e12))
((MkFixed :: Integer -> Fixed E9) <$> Gen.integral (Range.constantFrom 0 (-1e12) 1e12))
Copy link
Contributor

Choose a reason for hiding this comment

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

GHC 8.6.5: MkFixed @E9
GHC 8.10.2: MkFixed @_ @E9
So I went for something longer that should work with all versions

Comment on lines 64 to 68
ghc-options: -fno-warn-missing-deriving-strategies
if impl(ghc >=8.10)
ghc-options: -fno-warn-missing-safe-haskell-mode
-fno-warn-prepositive-qualified-module
-fno-warn-unused-packages
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer -Wno-X over -fno-warn-X, then it's consistent with the warning flags we use above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no opinion on this; I'm just taking the same approach as was used in cardano-preludehttps://github.com/input-output-hk/cardano-prelude/blob/master/cardano-prelude.cabal#L79

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I saw that too. Would you mind if I pushed a commit to this PR that changed it to -Wno-X?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at all!

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

mrBliss and others added 3 commits August 24, 2020 12:11
We use `-W` for enabling warning flags, we should use `-Wno-` for disabling
warning flags. The same way extension flags have switched a while ago from `-f`
to `-X`, warnings flags should switch to `-W`.
@nc6 nc6 marked this pull request as ready for review August 26, 2020 06:30
Copy link
Contributor

@mrBliss mrBliss left a comment

Choose a reason for hiding this comment

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

LGTM, I think you can remove these conditionals from the cabal files.

Comment on lines 63 to 68
if impl(ghc >=8.8)
ghc-options: -Wno-missing-deriving-strategies
if impl(ghc >=8.10)
ghc-options: -Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
-Wno-unused-packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, are all these flags that disable warnings even needed (in the other cabal files as well)? I assume you have copied them from cardano-prelude, but there -Weverything is used. Here -Wall is used, so these extra warnings don't have to be disabled. (I didn't have to disable them in IntersectMBO/ouroboros-network#2542)

I prefer -Wall + a manual selection of flags over -Weverything, which forces you to disable some flags based on the GHC version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, certainly some of them were needed in some places. But it's true that after adding them to a couple of files, I pre-emptively added them in other places...

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, I wouldn't disable -Wno-unused-packages, I'd just fix the warnings 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

I just tried removing all those flags myself and it compiled without warnings (except for those from the C code).

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer -Wall + a manual selection of flags over -Weverything, which forces you to disable some flags based on the GHC version.

In other words, no changes are needed to the cabal files at all.

@nc6 nc6 mentioned this pull request Aug 26, 2020
@mrBliss
Copy link
Contributor

mrBliss commented Aug 26, 2020

I'm assuming you're planning on rebasing/squashing? It would be nice to get those two merge commits out of the history.

@nc6 nc6 merged commit 13f44ad into master Aug 26, 2020
@iohk-bors iohk-bors bot deleted the nc/ghc810 branch August 26, 2020 08:18
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