... | ... | @@ -90,6 +90,42 @@ Foo.hs:7:10: error: |
|
|
|
|
|
As the error message indicates, this can be fixed in a backwards-compatible way by enabling `FlexibleContexts`.
|
|
|
|
|
|
### Subsumption-related changes to operator sections
|
|
|
|
|
|
GHC 9.2 implements further simplifications related to subsumption when typechecking, in addition to other simplifications made in 9.0. In particular, these changes concern the way that operator sections are typechecked. Some uses of operator sections involving operators with nested `forall`s or contexts in their type signatures will no longer typecheck in GHC 9.2, such as in this example:
|
|
|
|
|
|
```hs
|
|
|
f :: a -> forall b. b -> a
|
|
|
f x _ = x
|
|
|
|
|
|
g :: a -> a
|
|
|
g = (`f` "hello")
|
|
|
```
|
|
|
|
|
|
This will now fail with:
|
|
|
|
|
|
```
|
|
|
Bug.hs:8:6: error:
|
|
|
• Couldn't match type: forall b. b -> a
|
|
|
with: String -> a
|
|
|
Expected: a -> String -> a
|
|
|
Actual: a -> forall b. b -> a
|
|
|
• In the expression: f
|
|
|
In the expression: `f` "hello"
|
|
|
In an equation for ‘g’: g = (`f` "hello")
|
|
|
• Relevant bindings include g :: a -> a (bound at Bug.hs:8:1)
|
|
|
|
|
|
|
8 | g = (`f` "hello")
|
|
|
| ^^^
|
|
|
```
|
|
|
|
|
|
`g` can be made to typecheck once more through eta expansion:
|
|
|
|
|
|
```hs
|
|
|
g :: a -> a
|
|
|
g x = x `f` "hello"
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
|
|
## Library changes
|
... | ... | |