... | ... | @@ -23,7 +23,7 @@ In many cases, this can be fixed by rewriting `a = f . g` to `a x = f (g x)`. |
|
|
### Requirement for impredicative types
|
|
|
|
|
|
|
|
|
In previous versions of GHC, it was possible to hide an impredicative type behind a type synonym, because GHC did not always expand type synonyms when checking for impredicativity. GHC 8 is stricter in this regard, so code that compiled with `-XRankNTypes` may now require `-XImpredicativeTypes` (bearing in mind its potential brokenness) or may need to be rewritten to avoid impredicativity. See [\#10194](https://gitlab.haskell.org//ghc/ghc/issues/10194), [ this thread](https://mail.haskell.org/pipermail/ghc-devs/2016-February/011367.html), [ this thread](https://mail.haskell.org/pipermail/ghc-devs/2016-May/012144.html) and [ this thread](https://mail.haskell.org/pipermail/haskell-cafe/2016-June/124119.html).
|
|
|
In previous versions of GHC, it was possible to hide an impredicative type behind a type synonym, because GHC did not always expand type synonyms when checking for impredicativity. GHC 8 is stricter in this regard, so code that compiled with `-XRankNTypes` may now require `-XImpredicativeTypes` (bearing in mind its potential brokenness) or may need to be rewritten to avoid impredicativity. See [\#10194](https://gitlab.haskell.org//ghc/ghc/issues/10194), [this thread](https://mail.haskell.org/pipermail/ghc-devs/2016-February/011367.html), [this thread](https://mail.haskell.org/pipermail/ghc-devs/2016-May/012144.html) and [this thread](https://mail.haskell.org/pipermail/haskell-cafe/2016-June/124119.html).
|
|
|
|
|
|
### More conservative use of superclass constraints while solving
|
|
|
|
... | ... | @@ -136,7 +136,7 @@ The following suggestions are not mandatory but recommended for those who wish t |
|
|
<td></td></tr></table>
|
|
|
|
|
|
> `base-4.9.0.0` continues to generalise functions from `Monad` to `Applicative`. However, in order to avoid performance regressions due to sub-optimally defined `Applicative`/`Monad` instances, it's highly advised to follow the
|
|
|
> [ AMP+MRP refactoring guidelines ](migration/7.10#)
|
|
|
> [AMP+MRP refactoring guidelines ](migration/7.10#)
|
|
|
> that were already provided in the [GHC 7.10.x Migration Guide](migration/7.10).
|
|
|
|
|
|
>
|
... | ... | @@ -146,25 +146,25 @@ The following suggestions are not mandatory but recommended for those who wish t |
|
|
<td></td></tr></table>
|
|
|
|
|
|
>
|
|
|
> Starting with `base-4.9.0.0`, `Data.Semigroup` has moved into `base`, kicking off the [ prime:Libraries/Proposals/SemigroupMonoid](https://prime.haskell.org/intertrac/Libraries/Proposals/SemigroupMonoid) roadmap which will eventually lead to have `Semigroup` become a proper superclass of `Monoid`.
|
|
|
> Starting with `base-4.9.0.0`, `Data.Semigroup` has moved into `base`, kicking off the [prime:Libraries/Proposals/SemigroupMonoid](https://prime.haskell.org/intertrac/Libraries/Proposals/SemigroupMonoid) roadmap which will eventually lead to have `Semigroup` become a proper superclass of `Monoid`.
|
|
|
|
|
|
>
|
|
|
> In order to smooth the transition, it's important to have `Semigroup` instances in place as soon as possible, especially in library packages. In order to aid detecting missing instances two warnings have been implemented in GHC 8.0 (both implied by `-Wcompat`): `-Wnoncanonical-monoid-instances` and `-Wsemigroup`. Those warnings also help defining the instances in compliance with the envisioned transition scheme.
|
|
|
|
|
|
>
|
|
|
> The [ hackage:semigroups](http://hackage.haskell.org/package/semigroups) package can be used to avoid `-XCPP` usage by providing the same `Data.Semigroup` module for older GHCs.
|
|
|
> The [hackage:semigroups](http://hackage.haskell.org/package/semigroups) package can be used to avoid `-XCPP` usage by providing the same `Data.Semigroup` module for older GHCs.
|
|
|
|
|
|
<table><tr><th>Provide `MonadFail` instances</th>
|
|
|
<td></td></tr></table>
|
|
|
|
|
|
>
|
|
|
> See [ prime:Libraries/Proposals/MonadFail](https://prime.haskell.org/intertrac/Libraries/Proposals/MonadFail) for more details.
|
|
|
> See [prime:Libraries/Proposals/MonadFail](https://prime.haskell.org/intertrac/Libraries/Proposals/MonadFail) for more details.
|
|
|
|
|
|
>
|
|
|
> Again, in order to extend the compatibility window of your code it's recommended to provide instances early on. To this end, two warnings have been implemented to help with detecting code needing attention: `-Wmissing-monadfail-instances` (implied by `-Wcompat`) and `-Wnoncanonical-monadfail-instances` (not implied by `-Wcompat`).
|
|
|
|
|
|
>
|
|
|
> The [ hackage:fail](http://hackage.haskell.org/package/fail) package helps avoiding `-XCPP` usage and emulates the new `Control.Monad.Fail` module.
|
|
|
> The [hackage:fail](http://hackage.haskell.org/package/fail) package helps avoiding `-XCPP` usage and emulates the new `Control.Monad.Fail` module.
|
|
|
|
|
|
#### Reworked `HasCallStack` API
|
|
|
|
... | ... | @@ -222,7 +222,7 @@ dataMeta=MetaDataSymbolSymbolSymbolBool|MetaConsSymbolFixityIBool|MetaSel(MaybeS |
|
|
```
|
|
|
|
|
|
|
|
|
There is now only one instance for `Datatype`, `Constructor`, and `Selector`. (For more information on how this works, see [ this](https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GenericDeriving#Type-levelmetadataencoding).)
|
|
|
There is now only one instance for `Datatype`, `Constructor`, and `Selector`. (For more information on how this works, see [this](https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GenericDeriving#Type-levelmetadataencoding).)
|
|
|
|
|
|
```
|
|
|
instanceDatatype('MetaData n m p nt)where...instanceConstructor('MetaCons n f r)where...instanceSelector('MetaSel mn su ss ds)where...
|
... | ... | @@ -240,7 +240,7 @@ Notice that since `Example` has no record selector, it generated `('MetaSel 'Not |
|
|
|
|
|
### `template-haskell-2.11.0.0`
|
|
|
|
|
|
- Three `Info` constructors (`ClassOpI`, `DataConI`, and `VarI`) [ no longer have](http://git.haskell.org/ghc.git/commitdiff/575abf42e218925e456bf765abb14f069ac048a0) a `Fixity` field. Instead, all `Fixity` information for a given `Name` is now determined through the `reifyFixity` function, which returns `Just` the fixity if there is an explicit fixity declaration for that `Name`, and `Nothing` otherwise.
|
|
|
- Three `Info` constructors (`ClassOpI`, `DataConI`, and `VarI`) [no longer have](http://git.haskell.org/ghc.git/commitdiff/575abf42e218925e456bf765abb14f069ac048a0) a `Fixity` field. Instead, all `Fixity` information for a given `Name` is now determined through the `reifyFixity` function, which returns `Just` the fixity if there is an explicit fixity declaration for that `Name`, and `Nothing` otherwise.
|
|
|
|
|
|
- the `DataD`, `NewtypeD`, `DataInstD`, and `NewtypeInstD` constructors have a new field `Maybe Kind` ([\#10828](https://gitlab.haskell.org//ghc/ghc/issues/10828)), and take a `CxtQ` instead of a `[Name]` for the derived classes ([\#10819](https://gitlab.haskell.org//ghc/ghc/issues/10819)). If you don't know what to do, use `Nothing` for the kind signature. The field that used to be of type `[Name]` can be converted to a `CxtQ` using `mapM conT`.
|
|
|
|
... | ... | @@ -283,7 +283,7 @@ Notice that since `Example` has no record selector, it generated `('MetaSel 'Not |
|
|
- The `InstanceD` constructor
|
|
|
|
|
|
|
|
|
This was a late change introduced in GHC 8.0 RC4, see [ discussion](https://mail.haskell.org/pipermail/ghc-devs/2016-April/011803.html) for more details.
|
|
|
This was a late change introduced in GHC 8.0 RC4, see [discussion](https://mail.haskell.org/pipermail/ghc-devs/2016-April/011803.html) for more details.
|
|
|
|
|
|
of type `Dec` has an additional field of type `Maybe Overlap`. It is used to specify the overlapping behavior for the instances, as with the `{-# OVERLAP/S/PED/PING #-}` pragmas:
|
|
|
|
... | ... | @@ -300,7 +300,7 @@ Notice that since `Example` has no record selector, it generated `('MetaSel 'Not |
|
|
### `hsc2hs` defines an `#alignment` macro
|
|
|
|
|
|
|
|
|
Starting with version 0.68 [ hackage:hsc2hs](http://hackage.haskell.org/package/hsc2hs) now supports the `#alignment` macro, which can be used to calculate the alignment of a struct in bytes. It is common for `.hsc` files to implement `#alignment` manually via a `#let` directive:
|
|
|
Starting with version 0.68 [hackage:hsc2hs](http://hackage.haskell.org/package/hsc2hs) now supports the `#alignment` macro, which can be used to calculate the alignment of a struct in bytes. It is common for `.hsc` files to implement `#alignment` manually via a `#let` directive:
|
|
|
|
|
|
```
|
|
|
#let alignment t ="%lu",(unsigned long)offsetof(struct {char x__; t (y__);}, y__)
|
... | ... | |