summaryrefslogtreecommitdiff
path: root/docs/users_guide/8.8.1-notes.rst
blob: 4dd7ff1b0f400782c7095929d86c952a29fea1ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
.. _release-8-8-1:

Version 8.8.1
=============

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)``
  (previous GHC versions required extra parens: ``Proxy '((a :: A), (b :: B))``).

- :ghc-flag:`-Woverflowed-literals` checks all literals. Previously, it would
  only inspect boxed expression literals.

- :ghc-flag:`-Wempty-enumerations` now also works for ``Numeric.Natural``.

Compiler
~~~~~~~~

- The final phase of the ``MonadFail`` proposal has been implemented.
  Accordingly, the ``MonadFailDesugaring`` language extension is now
  deprecated, as its effects are always enabled. Similarly, the
  ``-Wnoncanonical-monadfail-instances`` flag is also deprecated, as there is
  no longer any way to define a "non-canonical" ``Monad`` or ``MonadFail``
  instance.

- New :ghc-flag:`-keep-hscpp-files` to keep the output of the CPP pre-processor.

- The :ghc-flag:`-Wcompat` warning group now includes :ghc-flag:`-Wstar-is-type`.

- New :ghc-flag:`-Wunused-packages` warning reports unused packages.

- The :ghc-flag:`-fllvm-pass-vectors-in-regs` flag is now deprecated as vector
  arguments are now passed in registers by default.

- The :ghc-flag:`-fblock-layout-cfg` flag enables a new code layout algorithm on x86.
  This is enabled by default at  :ghc-flag:`-O` and :ghc-flag:`-O2`.

- The deprecated ghc-flag ``-Wamp`` has been removed.

- Add new :ghc-flag:`-Wmissing-deriving-strategies` flag that warns users when they are not
  taking advantage of :extension:`DerivingStrategies`. The warning is supplied at each
  ``deriving`` site.

- Support for object splitting with the flag ``-split-objs`` is removed.  Using
  this flag now results in a warning and does nothing.  Use
  :ghc-flag:`-split-sections` instead.


Runtime system
~~~~~~~~~~~~~~

- Add and document new FFI functions ``hs_lock_stable_ptr_table``
  and ``hs_unlock_stable_ptr_table``. These replace the undocumented
  functions ``hs_lock_stable_tables`` and ``hs_unlock_stable_tables``,
  respectively. The latter should now be considered deprecated.

- Document the heretofore undocumented FFI function
  ``hs_free_stable_ptr_unsafe``, used in conjunction with manual
  locking and unlocking.

- The runtime linker on Windows has been overhauled to properly handle section
  alignment, lower the amount of wasted memory and lower the amount of in use memory.
  See :ghc-ticket:`13617`. Note that committed memory may be slightly higher.

- The output filename used for :ref:`eventlog output <rts-eventlog>` can now be
  specified with the :rts-flag:`-ol ⟨filename⟩` flag.

- Add support for generating a new type of output: extended interfaces files.
  Generation of these files, which sport a ``.hie`` suffix, is enabled via the
  ``-fwrite-ide-info`` flag. See :ref:`hie-options` for more information.

- A new flag ``-xp`` is added on x86_64. When it is passed, the runtime linker
  can load object files compiled with ``-fPIC -fexternal-dynamic-refs``
  anywhere in the address space. This used to be restricted to the low 2Gb.

Template Haskell
~~~~~~~~~~~~~~~~

- Reifying type classes no longer shows redundant class type variables and
  contexts in the type signature of each class method. For instance,
  reifying the following class: ::

    class C a where
      method :: a

  Used to produce the following: ::

    class C a where
      method :: forall a. C a => a

  Where the ``forall a. C a =>`` part is entirely redundant. This part is no
  longer included when reifying ``C``. It's possible that this may break some
  code which assumes the existence of ``forall a. C a =>``.

- Template Haskell has been updated to support visible kind applications and
  explicit ``foralls`` in type family instances and ``RULES``. These required
  a couple of backwards-incompatible changes to the ``template-haskell`` API.
  Please refer to the
  `GHC 8.8 Migration Guide <https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.8#template-haskell-21500>`__
  for more details.

- Template Haskell now supports implicit parameters and recursive do.

- Template Haskell splices can now embed assembler source (:ghc-ticket:`16180`)

``ghc-prim`` library
~~~~~~~~~~~~~~~~~~~~

- GHC now exposes a new primop, ``traceBinaryEvent#``. This primop writes
  eventlog events similar to ``traceEvent#`` but allows the user to pass
  the event payload as a binary blob instead of a zero-terminated
  ``ByteString``.

- The ``StableName#`` type parameter now has a phantom role instead of
  a representational one. There is really no reason to care about the
  type of the underlying object.

``ghc`` library
~~~~~~~~~~~~~~~


``base`` library
~~~~~~~~~~~~~~~~

- The final phase of the ``MonadFail`` proposal has been implemented. As a
  result of this change:

  - The ``fail`` method of ``Monad`` has been removed in favor of the method of
    the same name in the ``MonadFail`` class.

  - ``MonadFail(fail)`` is now re-exported from the ``Prelude`` and
    ``Control.Monad`` modules.

  These are breaking changes that may require you to update your code. Please
  refer to the
  `GHC 8.8 Migration Guide <https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.8#base-41300>`__
  for more details.

- Support the characters from recent versions of Unicode (up to v. 12) in literals
    (see :ghc-ticket:`5518`).

- The ``StableName`` type parameter now has a phantom role instead of
  a representational one. There is really no reason to care about the
  type of the underlying object.

- The functions ``zipWith3`` and ``zip3`` in ``Prelude`` can now fuse,
  together with ``zipWith4`` to ``zipWith7`` as well as their
  tuple counterparts in ``Data.List``.

Build system
~~~~~~~~~~~~

- Configure: Add ALEX and HAPPY variables to explicitly set the alex and happy
  programs to use.
- Configure: Deprecate --with-ghc=ARG in favour of the GHC variable.

Included libraries
------------------

The package database provided with this distribution also contains a number of
packages other than GHC itself. See the changelogs provided with these packages
for further change information.

.. ghc-package-list::

    libraries/array/array.cabal:             Dependency of ``ghc`` library
    libraries/base/base.cabal:               Core library
    libraries/binary/binary.cabal:           Dependency of ``ghc`` library
    libraries/bytestring/bytestring.cabal:   Dependency of ``ghc`` library
    libraries/Cabal/Cabal/Cabal.cabal:       Dependency of ``ghc-pkg`` utility
    libraries/containers/containers/containers.cabal:   Dependency of ``ghc`` library
    libraries/deepseq/deepseq.cabal:         Dependency of ``ghc`` library
    libraries/directory/directory.cabal:     Dependency of ``ghc`` library
    libraries/filepath/filepath.cabal:       Dependency of ``ghc`` library
    compiler/ghc.cabal:                      The compiler itself
    libraries/ghci/ghci.cabal:               The REPL interface
    libraries/ghc-boot/ghc-boot.cabal:       Internal compiler library
    libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library
    libraries/ghc-compact/ghc-compact.cabal: Core library
    libraries/ghc-heap/ghc-heap.cabal:       GHC heap-walking library
    libraries/ghc-prim/ghc-prim.cabal:       Core library
    libraries/haskeline/haskeline.cabal:     Dependency of ``ghci`` executable
    libraries/hpc/hpc.cabal:                 Dependency of ``hpc`` executable
    libraries/integer-gmp/integer-gmp.cabal: Core library
    libraries/libiserv/libiserv.cabal:       Internal compiler library
    libraries/mtl/mtl.cabal:                 Dependency of ``Cabal`` library
    libraries/parsec/parsec.cabal:           Dependency of ``Cabal`` library
    libraries/pretty/pretty.cabal:           Dependency of ``ghc`` library
    libraries/process/process.cabal:         Dependency of ``ghc`` library
    libraries/stm/stm.cabal:                 Dependency of ``haskeline`` library
    libraries/template-haskell/template-haskell.cabal:     Core library
    libraries/terminfo/terminfo.cabal:       Dependency of ``haskeline`` library
    libraries/text/text.cabal:               Dependency of ``Cabal`` library
    libraries/time/time.cabal:               Dependency of ``ghc`` library
    libraries/transformers/transformers.cabal: Dependency of ``ghc`` library
    libraries/unix/unix.cabal:               Dependency of ``ghc`` library
    libraries/Win32/Win32.cabal:             Dependency of ``ghc`` library
    libraries/xhtml/xhtml.cabal:             Dependency of ``haddock`` executable