Skip to content

Compatibility with GHC 9.0 #96

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

Merged
merged 3 commits into from
Jul 21, 2021
Merged

Compatibility with GHC 9.0 #96

merged 3 commits into from
Jul 21, 2021

Conversation

aspiwack
Copy link
Member

@aspiwack aspiwack commented Jul 6, 2021

The main difference in GHC 9.0 is the simplified subsumption rule,
which affects some of our dependencies as well as our own code.

Summary:

  • Adds a stack-ghc9.yaml to check 9.0+ compatibility. Notice how we
    need to use a development version of generic-lens.

  • Does a few manual 𝜂-expansions required by the simplified
    subsumption rule.

  • Remove the Writer.Discouraged module. It contained a single
    instance for Lift. This instance was not particularly useful as it
    depended on monad-unlift, which basically meant that it can only
    lift HasWriter through a ReaderT (the mtl has other instances
    of MonadWriter, but the listen function is written in an ad
    hoc
    manner for each). The monad-unlift package is deprecated by
    its author, and doesn't compile in GHC 9.0. Moreover the
    documentation of this instance said to prefer using Lift directly
    on the underlying state capability (which works for any monad transformer
    and is more efficient), and, since the only way that we provide to
    make a HasWriter capability is via a state capability, there were
    not many opportunities to use this instance.

    All in all, it seemed best to remove the instance. The only
    alternative I could think of being to internalise the monad-unlift
    constraint which doesn't make a ton of sense in my opinion.

The main difference in GHC 9.0 is the simplified subsumption rule,
which affects some of our dependencies as well as our own code.

Summary:

- Adds a `stack-ghc9.yaml` to check 9.0+ compatibility. Notice how we
  need to use a development version of `generic-lens`.
- Does a few manual 𝜂-expansions required by the simplified
  subsumption rule.
- Remove the `Writer.Discouraged` module. It contained a single
  instance for `Lift`. This instance was not particularly useful as it
  depended on `monad-unlift`, which basically meant that it can only
  lift `HasWriter` through a `ReaderT` (the `mtl` has other instances
  of `MonadWriter`, but the `listen` function is written in an _ad
  hoc_ manner for each). The `monad-unlift` package is deprecated by
  its author, and doesn't compile in GHC 9.0. Moreover the
  documentation of this instance said to prefer using `Lift` directly
  on the underlying state capability (which works for any monad transformer
  and is more efficient), and, since the only way that we provide to
  make a `HasWriter` capability is via a state capability, there were
  not many opportunities to use this instance.

  All in all, it seemed best to remove the instance. The only
  alternative I could think of being to internalise the `monad-unlift`
  constraint which doesn't make a ton of sense in my opinion.
@aspiwack aspiwack requested a review from aherrmann July 6, 2021 12:46
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

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

Thank you!

I agree that it makes sense to remove Capability.Writer.Discouraged.

@@ -58,7 +58,6 @@ library
Capability.Stream
Capability.TypeOf
Capability.Writer
Capability.Writer.Discouraged
Copy link
Member

Choose a reason for hiding this comment

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

This module is also referenced here. I think that paragraph can be removed now, given that Capability.Writer.Discouraged was the only such discouraged module.

@@ -0,0 +1,12 @@
resolver: nightly-2021-07-04
Copy link
Member

Choose a reason for hiding this comment

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

Can we test this configuration on CI?

aspiwack added 2 commits July 21, 2021 08:47
Now that the one remaining Discouraged module has been removed.
The GHC 9.0 build doesn't do any test, as they are performed by the
main branch.

This commit also fixes a caching bug in the Github action. It's too
small for a separate commit.
@aspiwack aspiwack force-pushed the ghc-9.0-compatibility branch from 67a6128 to ba61041 Compare July 21, 2021 07:07
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

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

Thank you!

@aherrmann aherrmann merged commit db84d2a into master Jul 21, 2021
@aherrmann aherrmann deleted the ghc-9.0-compatibility branch July 21, 2021 07:31
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