... | ... | @@ -58,6 +58,38 @@ instance Funct ('KProxy :: KProxy o) where |
|
|
-- type Codomain ('KProxy :: KProxy o) = NatTr (Proxy :: o -> Type)
|
|
|
```
|
|
|
|
|
|
### `UndecidableInstances` no longer implies `FlexibleContexts` in instance declarations
|
|
|
|
|
|
Previous versions of GHC would accept the following program, as the use of `UndecidableInstances` would imply the `FlexibleContexts` extension:
|
|
|
|
|
|
```hs
|
|
|
{-# LANGUAGE UndecidableInstances #-}
|
|
|
module Foo where
|
|
|
|
|
|
data T1 a
|
|
|
data T2 a = MkT2 (T1 a)
|
|
|
|
|
|
instance Eq (T1 a) => Eq (T2 a) where
|
|
|
MkT2 x == MkT2 y = x == y
|
|
|
```
|
|
|
|
|
|
GHC 9.2 tightens up the specification of `UndecidableInstances`, and one consequence of this is that `UndecidableInstances` no longer implies `FlexibleContexts`. As a result, the program above will no longer typecheck on GHC 9.2 or later:
|
|
|
|
|
|
```
|
|
|
$ ~/Software/ghc-9.1.20210201/bin/ghc Foo.hs
|
|
|
[1 of 1] Compiling Foo ( Foo.hs, Foo.o )
|
|
|
|
|
|
Foo.hs:7:10: error:
|
|
|
• Non type-variable argument in the constraint: Eq (T1 a)
|
|
|
(Use FlexibleContexts to permit this)
|
|
|
• In the instance declaration for ‘Eq (T2 a)’
|
|
|
|
|
|
|
7 | instance Eq (T1 a) => Eq (T2 a) where
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
```
|
|
|
|
|
|
As the error message indicates, this can be fixed in a backwards-compatible way by enabling `FlexibleContexts`.
|
|
|
|
|
|
---
|
|
|
|
|
|
## Library changes
|
... | ... | |