The significant changes to the various parts of the compiler are listed in the
following sections. There have also been numerous bug fixes and performance
improvements over the 8.6.1 release.
Highlights
----------
The highlights, since the 8.6.1 release, are:
- Many, many bug fixes.
- A new code layout algorithm for x86.
Full details
------------
Language
~~~~~~~~
- GHC now supports visible kind applications, as described in
`GHC proposal #15 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0015-type-level-type-applications.rst>`__. This extends the existing
:ref:`visible type applications <visible-type-application>` feature to permit
type applications at the type level (e.g., ``f :: Proxy ('Just @Bool 'True)``) in
addition to the term level (e.g., ``g = Just @Bool True``).
- GHC now allows explicitly binding type variables in type family instances and
rewrite rules, as described in
`GHC proposal #7 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0007-instance-foralls.rst>`__. For instance: ::
type family G a b where
forall x y. G [x] (Proxy y) = Double
forall z. G z z = Bool
{-# RULES "example" forall a. forall (x :: a). id x = x #-}
- :extension:`ScopedTypeVariables`: The type variable that a type signature on
a pattern can bring into scope can now stand for arbitrary types. Previously,
they could only stand in for other type variables, but this restriction was deemed
unnecessary in `GHC proposal #29 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0029-scoped-type-variables-types.rst>`__. Also see :ghc-ticket:`15050`.
- The pattern-match coverage checker now checks for cases that are unreachable
due to constructors have strict argument types. For instance, in the
following example: ::
data K = K1 | K2 !Void
f :: K -> ()
f K1 = ()
``K2`` cannot be matched on in ``f``, since it is impossible to construct a
terminating value of type ``Void``. Accordingly, GHC will not warn about
``K2`` (whereas previous versions of GHC would).
- ``(!)`` and ``(.)`` are now valid type operators: ::
type family a ! b
type family a . b
- ``forall`` is now always a keyword in types to provide more helpful
error messages when ``-XExplicitForall`` is off.
- An existential context no longer requires parenthesization: ::
class a + b
data D1 = forall a b. (a + b) => D1 a b
data D2 = forall a b. a + b => D2 a b -- now allowed
- ``{-# UNPACK #-}`` annotation no longer requires parenthesization: ::
data T = MkT1 { a :: {-# UNPACK #-} (Maybe Int && Bool) }
| MkT2 { a :: {-# UNPACK #-} Maybe Int && Bool } -- now allowed
data G where
MkG1 :: {-# UNPACK #-} (Maybe Int && Bool) -> G
MkG2 :: {-# UNPACK #-} Maybe Int && Bool -> G -- now allowed
- The requirement that kind signatures always be parenthesized has been relaxed.
For instance, it is now permissible to write ``Proxy '(a :: A, b :: B)``