... | ... | @@ -93,6 +93,29 @@ g = go |
|
|
go = f
|
|
|
```
|
|
|
|
|
|
A similar situation arises in this program:
|
|
|
|
|
|
```hs
|
|
|
type family F x
|
|
|
|
|
|
class C a b | b -> a
|
|
|
|
|
|
class C (F b) b => D b
|
|
|
|
|
|
f :: (C () b, D b) => Maybe b
|
|
|
f = g
|
|
|
|
|
|
g :: (C a b) => Maybe b
|
|
|
g = Nothing
|
|
|
```
|
|
|
|
|
|
GHC 9.4 will fail to compile this program because since it will not infer `F b ~ ()`. To make this compile with 9.4 or later, add that as an explicit constraint:
|
|
|
|
|
|
```hs
|
|
|
f :: (C () b, D b, F b ~ ()) => Maybe b
|
|
|
f = g
|
|
|
```
|
|
|
|
|
|
### No generalization over type variables determined by functional dependencies
|
|
|
|
|
|
A small change has been made to the way GHC infers types for definitions with no type signature: GHC will no longer generalize a function over a type variable determined by a functional dependency. For example:
|
... | ... | |