... | ... | @@ -10,18 +10,20 @@ This guide summarises the changes you may need to make to your code to migrate f |
|
|
### `StarIsType`
|
|
|
|
|
|
|
|
|
As part of [ this GHC proposal](https://github.com/ghc-proposals/ghc-proposals/blob/05721788de9ab6538def68c3c2c9dec50c9f24a8/proposals/0020-no-type-in-type.rst), a new `StarIsType` extension was introduced, which instructs GHC to treat `*` as a synonym for `Type` (from `Data.Kind`) instead of a binary type operator. To provide a migration path for code that uses `*` as a type operator, the `TypeOperators` extension implies `NoStarIsType` in GHC 8.6.
|
|
|
As part of [ this GHC proposal](https://github.com/ghc-proposals/ghc-proposals/blob/05721788de9ab6538def68c3c2c9dec50c9f24a8/proposals/0020-no-type-in-type.rst), a new `StarIsType` extension was introduced, which instructs GHC to treat `*` as a synonym for `Type` (from `Data.Kind`) instead of a binary type operator.
|
|
|
|
|
|
|
|
|
As a result, any code that simultaneously enables `TypeOperators` and uses `*` as a `Type` synonym will not compile in 8.6. There are two ways to adapt to this change:
|
|
|
|
|
|
1. Replace uses of `*` with `Type`. (This is backwards compatible back to GHC 8.0, when `Type` was introduced.)
|
|
|
1. Add the following CPP to the top of the module, after enabling `TypeOperators`:
|
|
|
`StarIsType` is enabled by default, and one consequence of this is that GHC will interpret any use of `*` as `Type`, even if it would have been previously interpreted as a binary type operator. A notable example of such a binary type operator is `GHC.TypeLits.*`, so code like:
|
|
|
|
|
|
```
|
|
|
#if __GLASGOW_HASKELL__ >=805{-# LANGUAGE StarIsType #-}#endif
|
|
|
importGHC.TypeLitsf::Proxy m ->Proxy n ->Proxy(m * n)f__=Proxy
|
|
|
```
|
|
|
|
|
|
|
|
|
Will not typecheck if `StarIsType` is enabled, since `m * n` is treated as if one had written `m Type n`. There are two ways to adapt to this:
|
|
|
|
|
|
1. Use `*` qualified (e.g., `Proxy (m GHC.TypeLits.* n`). This approach is compliant with the GHC three-release policy, as it does not require CPP to support older GHCs.
|
|
|
1. Enable the `NoStarIsType` extension. Since `(No)StarIsType` did not exist on older GHCs, this approach will require CPP in order to support older compilers.
|
|
|
|
|
|
### Constructor-less GADTs now require `GADTSyntax`
|
|
|
|
|
|
|
... | ... | |