summaryrefslogtreecommitdiff
path: root/docs/users_guide/8.2.1-notes.rst
blob: b3dd2de93eac06dfbb6b56d6afe3bfe9c8d0dce5 (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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
.. _release-8-2-1:

Release notes for version 8.2.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.0 branch.

Highlights
----------

The highlights since the 8.0 branch are:

- TODO FIXME
- SCC annotations can now be used for declarations.
- Heap overflow throws an exception in certain circumstances.

Full details
------------

- Heap overflow throws a catchable exception, provided that it was detected
  by the RTS during a GC cycle due to the program exceeding a limit set by
  ``+RTS -M``, and not due to an allocation being refused by the operating
  system.  This exception is thrown to the same thread that receives
  ``UserInterrupt`` exceptions, and may be caught by user programs.

Language
~~~~~~~~

-  TODO FIXME.

- Pattern synonym signatures can now be applied to multiple patterns, just like
  value-level binding signatures. See :ref:`patsyn-typing` for details.

Compiler
~~~~~~~~

-  TODO FIXME.

- Old profiling flags ``-auto-all``, ``-auto``, and ``-caf-all`` are deprecated
  and their usage provokes a compile-time warning.

- Support for adding cost centres to declarations is added. The same `SCC`
  syntax can be used, in addition to a new form for specifying the cost centre
  name. See :ref:`scc-pragma` for examples.

- GHC is now much more particular about :ghc-flag:`-XDefaultSignatures`. The
  type signature for a default method of a type class must now be the same as
  the corresponding main method's type signature modulo differences in the
  signatures' contexts. Otherwise, the typechecker will reject that class's
  definition. See :ref:`class-default-signatures` for further details.

- It is now possible to explicitly pick a strategy to use when deriving a
  class instance using the :ghc-flag:`-XDerivingStrategies` language extension
  (see :ref:`deriving-strategies`).

- :ghc-flag:`-XDeriveAnyClass` is no longer limited to type classes whose
  argument is of kind ``*`` or ``* -> *``.

- The means by which :ghc-flag:`-XDeriveAnyClass` infers instance contexts has
  been completely overhauled. The instance context is now inferred using the
  type signatures (and default type signatures) of the derived class's methods
  instead of using the datatype's definition, which often led to
  overconstrained instances or instances that didn't typecheck (or worse,
  triggered GHC panics). See the section on
  :ref:`DeriveAnyClass <derive-any-class>` for more details.

- GHC now allows standalone deriving using :ghc-flag:`-XDeriveAnyClass` on
  any data type, even if its data constructors are not in scope. This is
  consistent with the fact that this code (in the presence of
  :ghc-flag:`-XDeriveAnyClass`): ::

      deriving instance C T

  is exactly equivalent to: ::

      instance C T

  and the latter code has no restrictions about whether the data constructors
  of ``T`` are in scope.

- :ghc-flag:`-XGeneralizedNewtypeDeriving` now supports deriving type classes
  with associated type families. See the section on
  :ref:`GeneralizedNewtypeDeriving and associated type families
  <gnd-and-associated-types>`.

- :ghc-flag:`-XGeneralizedNewtypeDeriving` will no longer infer constraints
  when deriving a class with no methods. That is, this code: ::

      class Throws e
      newtype Id a = MkId a
        deriving Throws

  will now generate this instance: ::

      instance Throws (Id a)

  instead of this instance: ::

      instance Throws a => Throws (Id a)

  This change was motivated by the fact that the latter code has a strictly
  redundant ``Throws a`` constraint, so it would emit a warning when compiled
  with :ghc-flag:`-Wredundant-constraints`. The latter instance could still
  be derived if so desired using :ghc-flag:`-XStandaloneDeriving`: ::

      deriving instance Throws a => Throws (Id a)

- Add warning flag :ghc-flag:`-Wcpp-undef` which passes ``-Wundef`` to the C
  pre-processor causing the pre-processor to warn on uses of the ``#if``
  directive on undefined identifiers.

- GHC will no longer automatically infer the kind of higher-rank type synonyms;
  you must explicitly explicitly annotate the synonym with a kind signature.
  For example, given::

    data T :: (forall k. k -> Type) -> Type

  to define a synonym of ``T``, you must write::

    type TSyn = (T :: (forall k. k -> Type) -> Type)

- The Mingw-w64 toolchain for the Windows version of GHC has been updated. GHC now uses
  `GCC 6.2.0` and `binutils 2.27`.

- Previously, :ghc-flag:`-Wmissing-methods` would not warn whenever a type
  class method beginning with an underscore was not implemented in an instance.
  For instance, this code would compile without any warnings: ::

     class Foo a where
       _Bar :: a -> Int

     instance Foo Int

  :ghc-flag:`-Wmissing-methods` will now warn that ``_Bar`` is not implemented
  in the ``Foo Int`` instance.

- A new flag :ghc-flag:`-ddump-json` has been added. This flag dumps compiler
  output as JSON documents. It is experimental and will be refined depending
  on feedback from tooling authors for the next release.

- GHC is now able to better optimize polymorphic expressions by using known
  superclass dictionaries where possible. Some examples:

    -- uses of `Monad IO` or `Applicative IO` here are improved
    foo :: MonadBaseControl IO m => ...

    -- uses of `Monoid MyMonoid` here are improved
    bar :: MonadWriter MyMonoid m => ...

- GHC now derives the definition of ``<$`` when using ``DeriveFunctor``
  rather than using the default definition. This prevents unnecessary
  allocation and a potential space leak when deriving ``Functor`` for
  a recursive type.

- The :ghc-flag:`-XExtendedDefaultRules` extension now defaults multi-parameter
  typeclasses. See :ghc-ticket:`12923`.

- GHC now ignores ``RULES`` for data constructors (:ghc-ticket:`13290`).
  Previously, it accepted::

    "NotAllowed" forall x. Just x = e

  That rule will no longer take effect, and a warning will be issued. ``RULES``
  may still mention data constructors, but not in the outermost position::

    "StillWorks" forall x. f (Just x) = e

GHCi
~~~~

-  TODO FIXME.

- Added :ghc-flag:`-flocal-ghci-history` which uses current directory for `.ghci-history`.

- Added support for :ghc-flag:`-XStaticPointers` in interpreted modules. Note, however,
  that ``static`` expressions are still not allowed in expressions evaluated in the REPL.

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

-  TODO FIXME.

-  Reifying types that contain unboxed tuples now works correctly. (Previously,
   Template Haskell reified unboxed tuples as boxed tuples with twice their
   appropriate arity.)

-  Splicing singleton unboxed tuple types (e.g., ``(# Int #)``) now works
   correctly. Previously, Template Haskell would implicitly remove the
   parentheses when splicing, which would turn ``(# Int #)`` into ``Int``.

-  Add support for type signatures in patterns. (:ghc-ticket:`12164`)

-  Make quoting and reification return the same types.  (:ghc-ticket:`11629`)

-  More kind annotations appear in the left-hand sides of reified closed
   type family equations, in order to disambiguate types that would otherwise
   be ambiguous in the presence of :ghc-flag:`-XPolyKinds`.
   (:ghc-ticket:`12646`)

-  Quoted type signatures are more accurate with respect to implicitly
   quantified type variables. Before, if you quoted this: ::

     [d| id :: a -> a
         id x = x
       |]

   then the code that Template Haskell would give back to you would actually be
   this instead: ::

     id :: forall a. a -> a
     id x = x

   That is, quoting would explicitly quantify all type variables, even ones
   that were implicitly quantified in the source. This could be especially
   harmful if a kind variable was implicitly quantified. For example, if
   you took this quoted declaration: ::

     [d| idProxy :: forall proxy (b :: k). proxy b -> proxy b
         idProxy x = x
       |]

   and tried to splice it back in, you'd get this instead: ::

     idProxy :: forall k proxy (b :: k). proxy b -> proxy b
     idProxy x = x

   Now ``k`` is explicitly quantified, and that requires turning on
   :ghc-flag:`-XTypeInType`, whereas the original declaration did not!

   Template Haskell quoting now respects implicit quantification in type
   signatures, so the quoted declarations above now correctly leave the
   type variables ``a`` and ``k`` as implicitly quantified.
   (:ghc-ticket:`13018` and :ghc-ticket:`13123`)

- Looking up type constructors with symbol names (e.g., ``+``) now works
  as expected (:ghc-ticket:`11046`)


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

- TODO FIXME.

- Added support for *Compact Regions*, which offer a way to manually
  move long-lived data outside of the heap so that the garbage
  collector does not have to trace it repeatedly.  Compacted data can
  also be serialized, stored, and deserialized again later by the same
  program.  For more details see the :compact-ref:`Data.Compact
  <Data-Compact.html>` module.

- There is new support for improving performance on machines with a
  Non-Uniform Memory Architecture (NUMA).  See :rts-flag:`--numa`.
  This is supported on Linux and Windows systems.

- The garbage collector can be told to use fewer threads than the
  global number of capabilities set by :rts-flag:`-N`.  See
  :rts-flag:`-qn`, and a `blog post
  <http://simonmar.github.io/posts/2016-12-08-Haskell-in-the-datacentre.html>`_
  that describes this.

- The :ref:`heap profiler <prof-heap>` can now emit heap census data to the GHC
  event log, allowing heap profiles to be correlated with other tracing events
  (see :ghc-ticket:`11094`).

- Some bugs have been fixed in the stack-trace implementation in the
  profiler that sometimes resulted in incorrect stack traces and
  costs attributed to the wrong cost centre stack (see :ghc-ticket:`5654`).

- Added processor group support for Windows. This allows the runtime to allocate
  threads to all cores in systems which have multiple processor groups.
  (e.g. > 64 cores, see :ghc-ticket:`11054`)

- Output of :ref:`Event log <rts-eventlog>` data can now be configured.
  Enabling external tools to collect and analyze the event log data while the
  application is still running.

- advapi32, shell32 and user32 are now automatically loaded in GHCi. libGCC is also
  loaded when a depencency requires it. See :ghc-ticket:`13189`.

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

-  TODO FIXME.

Package system
~~~~~~~~~~~~~~

-  TODO FIXME.

hsc2hs
~~~~~~

-  TODO FIXME.

Libraries
---------

array
~~~~~

-  Version number XXXXX (was 0.5.0.0)


.. _lib-base:

base
~~~~

See ``changelog.md`` in the ``base`` package for full release notes.

-  Version number 4.10.0.0 (was 4.9.0.0)

- ``Data.Either`` now provides ``fromLeft`` and ``fromRight``

- ``Data.Type.Coercion`` now provides ``gcoerceWith``, which is analogous to
  ``gcastWith`` from ``Data.Type.Equality``.

- The ``Read1`` and ``Read2`` classes in ``Data.Functor.Classes`` have new
  methods, ``liftReadList(2)`` and ``liftReadListPrec(2)``, that are defined in
  terms of ``ReadPrec`` instead of ``ReadS``. This matches the interface
  provided in GHC's version of the ``Read`` class, and allows users to write
  more efficient ``Read1`` and ``Read2`` instances.

- Add ``type family AppendSymbol (m :: Symbol) (n :: Symbol) :: Symbol`` to
  ``GHC.TypeLits``

- Add ``GHC.TypeNats`` module with ``Natural``-based ``KnownNat``. The ``Nat``
  operations in ``GHC.TypeLits`` are a thin compatibility layer on top.
  Note: the ``KnownNat`` evidence is changed from an ``Integer`` to a ``Natural``.

- ``liftA2`` is now a method of the ``Applicative`` class. ``Traversable``
  deriving has been modified to use ``liftA2`` for the first two elements
  traversed in each constructor. ``liftA2`` is not yet in the ``Prelude``,
  and must currently be imported from ``Control.Applicative``. It is likely
  to be added to the ``Prelude`` in the future.

binary
~~~~~~

-  Version number XXXXX (was 0.7.1.0)

bytestring
~~~~~~~~~~

-  Version number XXXXX (was 0.10.4.0)

Cabal
~~~~~

-  Version number XXXXX (was 1.18.1.3)

containers
~~~~~~~~~~

-  Version number XXXXX (was 0.5.4.0)

compact
~~~~~~~

The ``compact`` library provides an experimental API for placing immutable
data structures into a contiguous memory region.  Data in these regions
is not traced during garbage collection and can be serialized to disk or
over the network.

- Version number 1.0.0.0 (newly added)

deepseq
~~~~~~~

-  Version number XXXXX (was 1.3.0.2)

directory
~~~~~~~~~

-  Version number XXXXX (was 1.2.0.2)

filepath
~~~~~~~~

-  Version number XXXXX (was 1.3.0.2)

ghc
~~~

-
ghc-boot
~~~~~~~~

-  This is an internal package. Use with caution.

-  TODO FIXME.

ghc-prim
~~~~~~~~

-  Version number XXXXX (was 0.3.1.0)

-  Added new ``isByteArrayPinned#`` and ``isMutableByteArrayPinned#`` operation.

-  New function ``noinline`` in ``GHC.Magic`` lets you mark that a function
   should not be inlined.  It is optimized away after the simplifier runs.

haskell98
~~~~~~~~~

-  Version number XXXXX (was 2.0.0.3)

haskell2010
~~~~~~~~~~~

-  Version number XXXXX (was 1.1.1.1)

hoopl
~~~~~

-  Version number XXXXX (was 3.10.0.0)

hpc
~~~

-  Version number XXXXX (was 0.6.0.1)

integer-gmp
~~~~~~~~~~~

-  Version number XXXXX (was 0.5.1.0)

old-locale
~~~~~~~~~~

-  Version number XXXXX (was 1.0.0.6)

old-time
~~~~~~~~

-  Version number XXXXX (was 1.1.0.2)

process
~~~~~~~

-  Version number XXXXX (was 1.2.0.0)

template-haskell
~~~~~~~~~~~~~~~~

-  Version number XXXXX (was 2.9.0.0)

-  Added support for unboxed sums :ghc-ticket:`12478`.

-  Added support for visible type applications :ghc-ticket:`12530`.

time
~~~~

-  Version number XXXXX (was 1.4.1)

unix
~~~~

-  Version number XXXXX (was 2.7.0.0)

Win32
~~~~~

-  Version number XXXXX (was 2.3.0.1)

Known bugs
----------

-  TODO FIXME