|
|
[[_TOC_]]
|
|
|
|
|
|
# GHC 8.8.x Migration Guide
|
|
|
|
|
|
|
... | ... | @@ -92,7 +94,7 @@ class C a where |
|
|
```
|
|
|
|
|
|
|
|
|
Then in previous versions of GHC, reifying `C` would give you something like this:
|
|
|
Then in previous versions of GHC, reifying `C` with Template Haskell would give you something like this:
|
|
|
|
|
|
|
|
|
```
|
... | ... | @@ -127,7 +129,7 @@ foo = () <$ pure () |
|
|
|
|
|
This produces no warnings on 8.0–8.6, but does warn on GHC 8.8:
|
|
|
|
|
|
```wiki
|
|
|
```
|
|
|
T13064.hs:5:1: warning: [-Wunused-imports (in -Wextra)]
|
|
|
The import of ‘pure’ from module ‘Prelude’ is redundant
|
|
|
```
|
... | ... | @@ -171,7 +173,7 @@ foo = () <$ Prelude.pure () |
|
|
|
|
|
As part of [this GHC proposal](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0030-remove-star-kind.rst), the uses of `*` that rely on the `StarIsType` extension now produce a warning:
|
|
|
|
|
|
```wiki
|
|
|
```
|
|
|
Prelude> type M = (Maybe :: * -> *)
|
|
|
|
|
|
<interactive>:1:20: warning: [-Wstar-is-type (in -Wcompat)]
|
... | ... | @@ -184,7 +186,7 @@ Prelude> type M = (Maybe :: * -> *) |
|
|
|
|
|
The recommended migration strategy is to follow the suggestion in the warning: import `Type` from the `Data.Kind` module and use it in place of `*`:
|
|
|
|
|
|
```wiki
|
|
|
```
|
|
|
Prelude Data.Kind> type M = (Maybe :: Type -> Type)
|
|
|
```
|
|
|
|
... | ... | @@ -225,7 +227,7 @@ foo = undefined |
|
|
>
|
|
|
>
|
|
|
|
|
|
1. Previously, it was possible to sneak in impredicative types through clever use of type synonyms. For instance, this code used to compile even without the `ImpredicativeTypes` extension enabled!
|
|
|
If GHC is complaining about type synonyms not being passed enough arguments or an 'illegal polymorphic type', try enabling `LiberalTypeSynonyms` in that module.
|
|
|
|
|
|
```
|
|
|
{-# LANGUAGE RankNTypes #-}
|
... | ... | @@ -243,13 +245,13 @@ f = [] |
|
|
>
|
|
|
>
|
|
|
|
|
|
```wiki
|
|
|
• Illegal polymorphic type: forall a. a -> a
|
|
|
GHC doesn't yet support impredicative polymorphism
|
|
|
• In the expansion of type synonym ‘Foo’
|
|
|
In the expansion of type synonym ‘Bar’
|
|
|
In the type signature: f :: [Bar ()]
|
|
|
```
|
|
|
```
|
|
|
• Illegal polymorphic type: forall a. a -> a
|
|
|
GHC doesn't yet support impredicative polymorphism
|
|
|
• In the expansion of type synonym ‘Foo’
|
|
|
In the expansion of type synonym ‘Bar’
|
|
|
In the type signature: f :: [Bar ()]
|
|
|
```
|
|
|
|
|
|
---
|
|
|
|
... | ... | @@ -262,7 +264,7 @@ f = [] |
|
|
|
|
|
The Template Haskell AST has changed to accommodate the [Visible kind application](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0015-type-level-type-applications.rst) and [ More explicit foralls](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0007-instance-foralls.rst) proposals, both of which debut in GHC 8.8. At a glance, the breaking API changes are as follows:
|
|
|
|
|
|
```
|
|
|
```diff
|
|
|
data Dec
|
|
|
= ...
|
|
|
- | DataInstD Cxt Name [Type] (Maybe Kind) [Con] [DerivClause]
|
... | ... | |