7.12.1-notes.rst 14 KB
Newer Older
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
.. _release-7-12-1:

Release notes for version 7.12.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 7.10 branch.

Highlights
----------

The highlights, since the 7.10 branch, are:

-  TODO FIXME

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

Language
~~~~~~~~

-  TODO FIXME.

-  The parser now supports Haddock comments on GADT data constructors.
   For example,

   ::

                             data Expr a where
                               -- | Just a normal sum
                               Sum :: Int -> Int -> Expr Int

-  Implicit parameters of the new ghc-prim type ``GHC.Types.CallStack``
   are treated specially, and automatically solved for the current
   source location. For example

   ::

                             f = print (?stk :: CallStack)

   will print the singleton stack containing the occurrence of ``?stk``.
   If there is another ``CallStack`` implicit in-scope, the new location
   will be appended to the existing stack, e.g.

   ::

                             f :: (?stk :: CallStack) => IO ()
                             f = print (?stk :: CallStack)

   will print the occurrence of ``?stk`` and the call-site of ``f``. The
   name of the implicit parameter does not matter.

   See the release notes for ghc-prim for a description of the
   ``CallStack`` type.

-  To conform to the common case, the default role assigned to
   parameters of datatypes declared in ``hs-boot`` files is
   ``representational``. However, if the constructor(s) for the datatype
   are given, it makes sense to do normal role inference. This is now
   implemented, effectively making the default role for non-abstract
   datatypes in ``hs-boot`` files to be ``phantom``, like it is in
   regular Haskell code.

-  Wildcards can be used in the type arguments of type/data family
   instance declarations to indicate that the name of a type variable
   doesn't matter. They will be replaced with new unique type variables.
   See :ref:`data-instance-declarations` for more details.

-  GHC now allows to declare type families as injective. Injectivity
   information can then be used by the typechecker. See
   :ref:`injective-ty-fams` for details.

-  Due to a :ghc-ticket:`security issue <10826>`, Safe Haskell now forbids
   annotations in programs marked as ``-XSafe``.

77
78
79
-  Generic instances can be derived for data types whose constructors have
   arguments with certain unlifted types. See :ref:`generic-programming` for
   more details.
80

81
82
83
-  The ``-XDeriveAnyClass`` extension now fills in associated type family
   default instances when deriving a class that contains them.

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
-  Users can now define record pattern synonyms. This allows pattern synonyms
   to behave more like normal data constructors. For example, ::

      pattern P :: a -> b -> (a, b)
      pattern P{x,y} = (x,y)

   will allow `P` to be used like a record data constructor and also defines
   selector functions `x :: (a, b) -> a` and `y :: (a, b) -> b`.

-  Pattern synonyms can now be bundled with type constructors. For a pattern
   synonym `P` and a type constructor `T`, `P` can be bundled with `T` so that
   when `T` is imported `P` is also imported. With this change
   a library author can provide either real data constructors or pattern
   synonyms in an opaque manner. See :ref:`pattern-synonyms` for details. ::

      -- Foo.hs
      module Foo ( T(P) ) where

      data T = T

      pattern P = T

      -- Baz.hs
      module Baz where

      -- P is imported
      import Foo (T(..))

112
113
114
115
116
-  Whenever a data instance is exported, the corresponding data family
   is exported, too. This allows one to write ::

     -- Foo.hs
     module Foo where
117

118
119
120
121
     data family T a

     -- Bar.hs
     module Bar where
122

123
     import Foo
124

125
126
127
128
     data instance T Int = MkT

     -- Baz.hs
     module Baz where
129

130
131
132
     import Bar (T(MkT))

   In previous versions of GHC, this required a workaround via an
133
   explicit export list in Bar.
134

135
136


137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Compiler
~~~~~~~~

-  Added the option ``-dth-dec-file``. This dumps out a .th.hs file of
   all Template Haskell declarations in a corresponding .hs file. The
   idea is that application developers can check this into their
   repository so that they can grep for identifiers used elsewhere that
   were defined in Template Haskell. This is similar to using
   ``-ddump-to-file`` with ``-ddump-splices`` but it always generates a
   file instead of being coupled to ``-ddump-to-file`` and only outputs
   code that does not exist in the .hs file and a comment for the splice
   location in the original file.

-  Added the option ``-fprint-expanded-types``. When enabled, GHC also
   prints type-synonym-expanded types in type errors.

-  Added the option ``-fcpr-anal``. When enabled, the demand analyser
   performs CPR analysis. It is implied by ``-O``. Consequently,
   ``-fcpr-off`` is now removed, run with ``-fno-cpr-anal`` to get the
   old ``-fcpr-off`` behaviour.

158
159
160
161
162
163
-  Added the option ``-fworker-wrapper``. When enabled, the worker-wrapper
   transformation is performed after a strictness analysis pass. It is implied
   by ``-O`` and by ``-fstrictness``. It is disabled by ``-fno-strictness``.
   Enabling ``-fworker-wrapper`` while strictness analysis is disabled (by
   ``-fno-strictness``) has no effect.

164
165
166
167
168
169
170
-  Added the options ``-fwarn-missed-specialisations`` and
   ``-fwarn-all-missed-specialisations``. When enabled, the simplifier will
   produce a warning when a overloaded imported function cannot be
   specialised (typically due to a missing ``INLINEABLE`` pragma). This
   is intended to alert users to cases where they apply ``INLINEABLE`` but
   may not get the speed-up they expect.

171
172
173
174
-  Added the option ``-fwarn-noncanonical-monad-instances`` which helps
   detect noncanonical ``Applicative``/``Monad`` instance definitions.
   See flag description in :ref:`options-sanity` for more details.

175
176
177
-  When printing an out-of-scope error message, GHC will give helpful advice if
   the error might be caused by too restrictive imports.

quchen's avatar
quchen committed
178
179
180
181
182
183
184
185
186
-  Added the ``-Wcompat`` warning group, along with its opposite
   ``-Wno-compat``. Turns on warnings that will be enabled by default in the
   future, but remain off in normal compilations for the time being. This
   allows library authors eager to make their code future compatible to adapt
   to new features before they even generate warnings.

-  Added the ``-fwarn-missing-monadfail-instance`` flag. When enabled, this
   will issue a warning if a failable pattern is used in a context that does
   not have a ``MonadFail`` constraint. This flag represents phase 1 of the
187
188
   `MonadFail Proposal (MFP)
   <https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail>`__.
quchen's avatar
quchen committed
189

190
191
192
193
194
195
-  Added the ``-fwarn-semigroup`` flag. When enabled, this
   will issue a warning if a type is an instance of ``Monoid`` but not
   ``Semigroup``, and when a custom definition ``(<>)`` is made. Fixing these
   warnings makes sure the definition of ``Semigroup`` as a superclass of
   ``Monoid`` does not break any code.

196
197
198
199
- Added the ``-fwarn-missing-pat-syn-sigs`` flag. When enabled, this will issue
  a warning when a pattern synonym definition doesn't have a type signature.
  It is turned off by default but enabled by ``-Wall``.

200
201
202
203
204
205
GHCi
~~~~

-  ``Main`` with an explicit module header but without ``main`` is now
   an error (#7765).

206
-  The ``:back`` and ``:forward`` commands now take an optional count
207
208
209
   allowing the user to move forward or backward in history several
   steps at a time.

210
-  Added commands ``:load!`` and ``:reload!``, effectively setting
211
212
213
   "-fdefer-type-errors" before loading a module and unsetting it after
   loading if it has not been set before (#8353).

214
215
-  ``ghci -e`` now behaves like ``ghc -e`` (#9360).

roshats's avatar
roshats committed
216
217
-  Added support for top-level function declarations (#7253).

218
219
220
Template Haskell
~~~~~~~~~~~~~~~~

221
222
223
224
225
-  The new ``-XTemplateHaskellQuotes`` flag allows to use the
   quotes (not quasi-quotes) subset of ``TemplateHaskell``.  This is
   particularly useful for use with a stage 1 compiler (i.e. GHC
   without interpreter support). Also, ``-XTemplateHaskellQuotes`` is
   considered safe under Safe Haskell.
226
227
228
229

-  Partial type signatures can now be used in splices, see
   :ref:`pts-where`.

230
231
232
233
-  ``Template Haskell`` now fully supports typed holes and quoting unbound
   variables.  This means it is now possible to use pattern splices nested
   inside quotation brackets.

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
-  ``Template Haskell`` now supports the use of ``UInfixT`` in types to
   resolve infix operator fixities, in the same vein as ``UInfixP`` and
   ``UInfixE`` in patterns and expressions. ``ParensT`` and ``InfixT``
   have also been introduced, serving the same functions as their
   pattern and expression counterparts.

-  Primitive chars (e.g., ``[| 'a'# |]``) and primitive strings (e.g.,
   ``[| "abc"# |]``) can now be quoted with Template Haskell. The
   ``Lit`` data type also has a new constructor, ``CharPrimL``, for
   primitive char literals.

-  ``addTopDecls`` now accepts annotation pragmas.

-  Internally, the implementation of quasi-quotes has been unified with
   that of normal Template Haskell splices. Under the previous
   implementation, top-level declaration quasi-quotes did not cause a
   break in the declaration groups, unlike splices of the form
   ``$(...)``. This behavior has been preserved under the new
   implementation, and is now recognized and documented in
   :ref:`th-syntax`.

-  The ``Lift`` class is now derivable via the ``-XDeriveLift`` extension. See
   :ref:`deriving-lift` for more information.


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

Ben Gamari's avatar
Ben Gamari committed
262
-  Support for performance monitoring with PAPI has been dropped.
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284

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

-  TODO FIXME.

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

-  TODO FIXME.

Libraries
---------

array
~~~~~

-  Version number XXXXX (was 0.5.0.0)

base
~~~~

Ben Gamari's avatar
Ben Gamari committed
285
-  Version number 4.9.0.0 (was 4.7.0.0)
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308

-  A new module ``GHC.SrcLoc`` was added, exporting a new type
   ``SrcLoc``. A ``SrcLoc`` contains package, module, and file names, as
   well as start and end positions.

-  A new type ``CallStack`` was added for use with the new implicit
   callstack parameters. A ``CallStack`` is a ``[(String, SrcLoc)]``,
   sorted by most-recent call.

-  A new function, ``interruptible``, was added to ``GHC.IO`` allowing
   an ``IO`` action to be run such that it can be interrupted by an
   asynchronous exception, even if exceptions are masked (except if
   masked with ``interruptibleMask``).

   This was introduced to fix the behavior of ``allowInterrupt``, which
   would previously incorrectly allow exceptions in uninterruptible
   regions (see :ghc-ticket:`9516`).

-  Per-thread allocation counters (``setAllocationCounter`` and
   ``getAllocationCounter``) and limits (``enableAllocationLimit``,
   ``disableAllocationLimit`` are now available from ``System.Mem``. Previously
   this functionality was only available from ``GHC.Conc``.

309
310
311
312
313
- ``forever``, ``filterM``, ``mapAndUnzipM``, ``zipWithM``, ``zipWithM_``,
  ``replicateM``, and ``replicateM`` were generalized from ``Monad`` to
  ``Applicative``. If this causes performance regressions, try to make the
  implementation of ``(*>)`` match that of ``(>>)``.

Ben Gamari's avatar
Ben Gamari committed
314
315
- Add ``GHC.TypeLits.TypeError`` and ``ErrorMessage`` to allow users
  to define custom compile-time error messages.
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

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)

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
~~~

-  TODO FIXME.

-  The ``HsBang`` type has been removed in favour of ``HsSrcBang`` and
   ``HsImplBang``. Data constructors now always carry around their
   strictness annotations as the user wrote them, whether from an
   imported module or not.

362
363
364
365
-  Moved `startsVarSym`, `startsVarId`, `startsConSym`, `startsConId`,
   `startsVarSymASCII`, and `isVarSymChar` from `Lexeme` to the `GHC.Lemexe`
   module of the `ghc-boot` library.

366
367
- Add `isImport`, `isDecl`, and `isStmt` functions.

368
369
370
371
372
373
374
375
376
377
378
379
380
381
ghc-boot
~~~~~~~~

-  This is an internal package. Use with caution.

-  This package was renamed from `bin-package-db` to reflect its new purpose
   of containing intra-GHC functionality that needs to be shared across
   multiple GHC boot libraries.

-  Added `GHC.Lexeme`, which contains functions for determining if a
   character can be the first letter of a variable or data constructor in
   Haskell, as defined by GHC. (These functions were moved from `Lexeme`
   in `ghc`.)

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
ghc-prim
~~~~~~~~

-  Version number XXXXX (was 0.3.1.0)

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)

-  The ``Lift`` type class for lifting values into Template Haskell
   splices now has a default signature ``lift :: Data a => a -> Q Exp``,
   which means that you do not have to provide an explicit
   implementation of ``lift`` for types which have a ``Data`` instance.
   To manually use this default implementation, you can use the
   ``liftData`` function which is now exported from
   ``Language.Haskell.TH.Syntax``.

-  ``Info``'s constructors no longer have ``Fixity`` fields. A
   ``qReifyFixity`` function was added to the ``Quasi`` type class (as
   well as the ``reifyFixity`` function, specialized for ``Q``) to allow
   lookup of fixity information for any given ``Name``.

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