|
|
[[_TOC_]]
|
|
|
|
|
|
# GHC 8.10.x Migration Guide
|
|
|
|
|
|
|
... | ... | @@ -83,6 +85,42 @@ GHC 8.10 implements [proposal 24](https://github.com/ghc-proposals/ghc-proposals |
|
|
type T = Just Nothing :: Maybe (Maybe a) -- still accepted
|
|
|
```
|
|
|
|
|
|
### GHC infers fewer dependent kinds
|
|
|
|
|
|
GHC 8.10 features improvements to its kind inference engine. One downside to this is that it is slightly more conservative about inferring dependent kinds than it used to be. For example, the following example will kind-check on old versions of GHC, but not with GHC 8.10:
|
|
|
|
|
|
```hs
|
|
|
{-# LANGUAGE DataKinds, GADTs, PolyKinds, ScopedTypeVariables #-}
|
|
|
module Foo where
|
|
|
|
|
|
import Data.Kind
|
|
|
|
|
|
data T a where
|
|
|
MkT1 :: T Int
|
|
|
MkT2 :: T Bool
|
|
|
|
|
|
data ST a :: T a -> Type where
|
|
|
SMkT1 :: ST Int MkT1
|
|
|
SMkT2 :: ST Bool MkT2
|
|
|
```
|
|
|
```
|
|
|
Foo.hs:11:20: error:
|
|
|
• Expected kind ‘T a’, but ‘MkT1’ has kind ‘T Int’
|
|
|
• In the second argument of ‘ST’, namely ‘MkT1’
|
|
|
In the type ‘ST Int MkT1’
|
|
|
In the definition of data constructor ‘SMkT1’
|
|
|
|
|
|
|
11 | SMkT1 :: ST Int MkT1
|
|
|
| ^^^^
|
|
|
```
|
|
|
|
|
|
To fix this issue, one must give `ST` a complete, user-specified kind signature (consult [the relevant users' guide section](https://downloads.haskell.org/~ghc/8.6.4/docs/html/users_guide/glasgow_exts.html#complete-user-supplied-kind-signatures-and-polymorphic-recursion) for a more detailed description on what this means). In other words, apply the following change:
|
|
|
|
|
|
```diff
|
|
|
-data ST a :: T a -> Type where
|
|
|
+data ST (a :: Type) :: T a -> Type where
|
|
|
```
|
|
|
|
|
|
### New RecordWildCards warnings
|
|
|
|
|
|
GHC 8.10 introduces two new flags, `-Wunused-record-wildcards` and `-Wredundant-record-wildcards`, which are implied by `-Wall`. This means that certain programs that use `RecordWildCards` will trigger warnings that did not do so previously. For instance, the following program emits no warnings on old versions of GHC, but will warn with GHC 8.10:
|
... | ... | |