-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
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.
67a6128
to
ba61041
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
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 weneed 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 singleinstance for
Lift
. This instance was not particularly useful as itdepended on
monad-unlift
, which basically meant that it can onlylift
HasWriter
through aReaderT
(themtl
has other instancesof
MonadWriter
, but thelisten
function is written in an adhoc manner for each). The
monad-unlift
package is deprecated byits author, and doesn't compile in GHC 9.0. Moreover the
documentation of this instance said to prefer using
Lift
directlyon 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 werenot 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.