Skip to content

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.

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.

3 participants