summaryrefslogtreecommitdiff
path: root/docs/users_guide/8.6.1-notes.rst
blob: cfa28806eb0cc34a0381189cc9dd91cac71d3f4d (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
.. _release-8-6-1:

Release notes for version 8.6.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.4.1 release.


Highlights
----------

The highlights, since the 8.4.1 release, are:

- Programs are no longer constrained by the Windows ``MAX_PATH`` file path
  length limit. The file path limit is now approximately 32,767 characters. Note
  that GHC itself is still somewhat limited due to GCC not supporting file
  namespaced paths. Paths that are passed directly to the compiler, linker or
  other GNU tools are currently still constrained. See :ref:`windows-file-paths`
  for details.

- Many, many bug fixes.


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

Language
~~~~~~~~

- Use of quantified type variables in constraints is now allowed via the
  :extension:`QuantifiedConstraints` language extension. This long-awaited feature
  enables users to encode significantly more precision in their types. For instance,
  the common ``MonadTrans`` typeclass could now make the expectation that an
  applied transformer is must be a ``Monad`` ::

      class (forall m. Monad m => Monad (t m)) => MonadTrans t where {- ... -}

  Additionally, quantification can enable terminating instance resolution
  where this previously was not possible. See :ref:`quantified-constraints` for
  details.

- A new :extension:`DerivingVia` language extension has been added which allows
  the use of the ``via`` deriving strategy. For instance: ::

    newtype T = MkT Int
      deriving Monoid via (Sum Int)

  See :ref:`deriving-via` for more information.

- A new :extension:`StarIsType` language extension has been added which controls
  whether ``*`` is parsed as ``Data.Kind.Type`` or a regular type operator.
  :extension:`StarIsType` is enabled by default.

- GHC now permits the use of a wildcard type as the context of a standalone
  ``deriving`` declaration with the use of the
  :extension:`PartialTypeSignatures` language extension. For instance, this
  declaration: ::

    deriving instance _ => Eq (Foo a)

  Denotes a derived ``Eq (Foo a)`` instance, where the context is inferred in
  much the same way as ordinary ``deriving`` clauses do.
  See :ref:`partial-type-signatures`.

- Data declarations with empty ``where`` clauses are no longer valid without the
  extension :extension:`GADTSyntax` enabled. For instance, consider the
  following, ::

      data T where

  The grammar is invalid in Haskell2010. Previously it could be compiled successfully
  without ``GADTs``. As of GHC 8.6.1, this is a parse error.

- Incomplete patterns warning :ghc-flag:`-Wincomplete-patterns` is extended to
  guards in pattern bindings and ``if`` alternatives of :extension:`MultiWayIf`.
  For instance, consider the following, ::

      foo :: Bool -> Int
      foo b = if | b -> 1

  In GHC 8.6.1, it will raise the warning: ::

      <interactive>:2:12: warning: [-Wincomplete-patterns]
          Pattern match(es) are non-exhaustive
          In a multi-way if alternative:
              Guards do not cover entire pattern space

  See :ghc-ticket:`14773`.

- Scoped type variables now work in default methods of class declarations
  and in pattern synonyms in Template Haskell. See :ghc-ticket:`14885`.

- ``do`` expressions, lambda expressions, etc. to be directly used as
  a function argument, enabled with :extension:`BlockArguments`.
  See :ref:`More liberal syntax for function arguments <block-arguments>`
  for the full details.

- Underscores in numeric literals (e.g. ``1_000_000``), enabled with
  :extension:`NumericUnderscores`.
  See :ref:`Numeric underscores <numeric-underscores>`
  for the full details.

- CUSKs now require all kind variables to be explicitly quantified. This was
  already the case with :extension:`TypeInType`, but now :extension:`PolyKinds`
  also exhibits this behavior. This means that the following example is no
  longer considered to have a CUSK::

   data T1 :: k -> Type       -- No CUSK: `k` is not explicitly quantified

- Functionality of :extension:`TypeInType` has been subsumed by
  :extension:`PolyKinds`, and it is now merely a shorthand for
  :extension:`PolyKinds`, :extension:`DataKinds`, and :extension:`NoStarIsType`.
  The users are advised to avoid :extension:`TypeInType` due to its misleading
  name: the ``Type :: Type`` axiom holds regardless of whether it is enabled.

- GHC has become more diligent about catching illegal uses of kind polymorphism.
  For instance, GHC 8.4 would accept the following without the use of
  :extension:`PolyKinds`::

    f :: forall k (a :: k). Proxy a
    f = Proxy

  This is now an error unless :extension:`PolyKinds` is enabled.

- The plugin mechanism has been extended to allow plugins to run between frontend
  phases. Of particular note are the parser and typechecker plugins which run
  after parsing and typechecking have completed. Collectively, these new extension
  points are called :ref:`source plugins <source-plugins>`.
	
- Type literals now could be used in type class instances without the extension
  :extension:`FlexibleInstances`.

  See :ghc-ticket:`13833`.

- :extension:`MonadFailDesugaring` is now enabled by default. See
  `MonadFail Proposal (MFP)
  <https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail>`__
  for more details.

Compiler
~~~~~~~~

- GHC now no longer adds the current file's directory as a general include path
  calling the C compiler. Instead we use :ghc-flag:`-iquote` to only add it as
  an include path for `#include ""`. See :ghc-ticket:`14312`.

- GHC now supports British spelling of :extension:`GeneralizedNewtypeDeriving`.

- GHC now does significantly more constant folding in its core-to-core optimiser.
  This will result in significantly better code being generated for some
  programs. See :ghc-ticket:`9136`.

- GHC now offers significantly more information about typed holes such as valid
  hole fits and refinement hole fits. See :ref:`Valid Hole Fits <typed-hole-valid-hole-fits>`
  for more information.

- The code-generation effects of :ghc-flag:`-dynamic` can now be
  enabled independently by the flag
  :ghc-flag:`-fexternal-dynamic-refs`. If you don't know why you might
  need this, you don't need it.

- :ghc-flag:`-Wcompat` now includes :ghc-flag:`-Wimplicit-kind-vars` to
  provide early detection of breakage that will be caused by implementation of
  `GHC proposal #24
  <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0024-no-kind-vars.rst>`__
  in a future release.

Plugins
~~~~~~~

- GHC's plugin mechanism now offers plugin authors control over their plugin's
  effect on recompilation checking. Specifically the ``Plugin`` record name has
  a new field ::

    data Plugin = Plugin {
        pluginRecompile :: [CommandLineOption] -> IO PluginRecompile
      , {- ... -}
      }

    data PluginRecompile = ForceRecompile | NoForceRecompile | MaybeRecompile Fingerprint

  Plugin based on ``defaultPlugin`` will have their previous recompilation
  behavior (``ForceRecompile``) preserved. However, plugins that are "pure" are
  encouraged to override this to either ``NoForceRecompile`` or ``MaybeRecompile``.
  See :ref:`plugin_recompilation` for details.

- GHC now provides a class of new plugins: source plugins. These plugins can
  inspect and modify a variety of intermediate representations used by the
  compiler's frontend. These include:

    * The ability to modify the parser output
    * The ability to inspect the renamer output
    * The ability to modify the typechecked AST
    * The ability to modify Template Haskell splices
    * The ability to modify interface files as they are loaded

  See :ref:`source-plugins` for details.

GHCi
~~~~

- Added an experimental :ghci-cmd:`:doc` command that displays the
  documentation for a declaration.

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

- The GHC runtime linker now prefers user shared libraries above system ones.
  When extra search directories are specified these are searched before anything
  else. This fixes ``iuuc`` on Windows given the proper search directories (e.g
  ``-L/mingw64/lib``).

- The GHC runtime linker now uses ``LIBRARY_PATH`` and the runtime loader now also
  searches ``LD_LIBRARY_PATH``.

- The GHC runtime on Windows is no longer constrained by the ``MAX_PATH`` file path
  length limitation. See :ref:`windows-file-paths`.

- The runtime now allows use of the :rts-flag:`-hT` profiling variety on
  programs built with :ghc-flag:`-prof`.

- The STM assertions mechanism (namely the ``always`` and ``alwaysSucceeds``
  functions) has been removed. This happened a bit earlier than proposed in the
  deprecation pragma included in GHC 8.4, but due to community feedback we
  decided to move ahead with the early removal.

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

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


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

- ``($!)`` is now representation-polymorphic like ``($)``.

- The module ``Data.Functor.Contravariant`` has been moved from the
  ``contravariant`` package into ``base``. All the other modules in
  ``contravariant`` (``Data.Functor.Contravariant.Divisible``, etc.)
  have not been moved to ``base``, and they still reside in ``contravariant``.

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

-  Version number 0.5.2.1 (was 0.5.2.0)

-  Added new ``addWordC#`` operation for unsigned addition with carry.

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


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:   Deppendency of ``ghc`` library
    libraries/Cabal/Cabal/Cabal.cabal:       Dependency of ``ghc-pkg`` utility
    libraries/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-compact/ghc-compact.cabal: Core 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/mtl/mtl.cabal:                 Dependency of ``Cabal`` library
    libraries/parsec/parsec.cabal:           Dependency of ``Cabal`` library
    libraries/process/process.cabal:         Dependency of ``ghc`` library
    libraries/template-haskell/template-haskell.cabal:     Core 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