6.14 -> 7.0
[ghc-hetmet.git] / docs / users_guide / 7.0.1-notes.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <sect1 id="release-7-0-1">
3   <title>Release notes for version 7.0.1</title>
4
5   <para>
6     The significant changes to the various parts of the compiler are
7     listed in the following sections. There have also been numerous bug
8     fixes and performance improvements over the 6.12 branch.
9   </para>
10
11   <sect2>
12     <title>Highlights</title>
13     <itemizedlist>
14       <listitem>
15         <para>
16           GHC now defaults to the Haskell 2010 language standard.
17         </para>
18
19         <para>
20           Libraries are not quite so straightforward.  By default, GHC
21           provides access to the <literal>base</literal> package,
22           which includes the Haskell 2010 libraries, albeit with a few
23           minor differences.  For those who want to write strictly
24           standards-conforming code we also provide
25           the <literal>haskell2010</literal> package which provides
26           the precise APIs specified by Haskell 2010, but because the
27           module names in this package overlap with those in
28           the <literal>base</literal> package it is not possible to
29           use both <literal>haskell2010</literal>
30           and <literal>base</literal> at the same time (this also
31           applies to the <literal>array</literal> package).  Hence to use
32           the Haskell 2010 libraries you should hide
33           the <literal>base</literal> and <literal>array</literal>
34           packages, for example with GHCi:
35 <screen>
36 $ ghci -package haskell2010 -hide-package base -hide-package array
37 </screen>
38           If you are using Cabal it isn't necessary to
39           hide <literal>base</literal> and <literal>array</literal>
40           explicitly, just don't include them in your <literal>build-depends</literal>.
41         </para>
42       </listitem>
43
44       <listitem>
45         <para>
46           On POSIX platforms, there is a new I/O manager based on
47           epoll/kqueue/poll, which allows multithreaded I/O code to
48           scale to a much larger number (100k+) of threads.
49         </para>
50       </listitem>
51
52       <listitem>
53         <para>
54           The inliner has been overhauled, which should in general
55           give better performance while reducing unnecessary code-size
56           explosion.
57         </para>
58       </listitem>
59
60       <listitem>
61         <para>
62           Large parts of the runtime system have been overhauled, in
63           particular the machinery related to blocking and wakeup of
64           threads and exception throwing (<literal>throwTo</literal>).
65           Several instances of pathological performance have been
66           fixed, especially where large numbers of threads are
67           involved.
68         </para>
69       </listitem>
70
71       <listitem>
72         <para>
73           Due to changes in the runtime system, if you are
74           using <literal>Control.Parallel.Strategies</literal> from
75           the <literal>parallel</literal> package, please upgrade to
76           at least version 2 (preferably version 3).  The
77           implementation of Strategies
78           in <literal>parallel-1.x</literal> will lose parallelism
79           with GHC 7.0.1.
80         </para>
81       </listitem>
82
83       <listitem>
84         <para>
85           The full Haskell <literal>import</literal> syntax can now been
86           used to bring modules into scope in GHCi, e.g.
87         </para>
88 <programlisting>
89 Prelude> import Data.List as L
90 Prelude Data.List> L.length "foo"
91 3
92 </programlisting>
93       </listitem>
94
95       <listitem>
96         <para>
97           GHC now comes with a more recent mingw bundled on Windows,
98           which includes a fix for windres on Windows 7.
99         </para>
100       </listitem>
101     </itemizedlist>
102   </sect2>
103
104   <sect2>
105     <title>Language changes</title>
106     <itemizedlist>
107       <listitem>
108         <para>
109           GHC now understands the <literal>Haskell98</literal> and
110           <literal>Haskell2010</literal> languages.
111         </para>
112
113         <para>
114           These get processed before the language extension pragmas,
115           and define the default sets of extensions that are enabled.
116           If neither is specified, then the default is
117           <literal>Haskell2010</literal> plus the
118           <literal>MonoPatBinds</literal> extension.
119         </para>
120       </listitem>
121
122       <listitem>
123         <para>
124           GHC now supports the <literal>DoAndIfThenElse</literal>
125           extension, which is part of the Haskell 2010 standard.
126         </para>
127       </listitem>
128
129       <listitem>
130         <para>
131           Datatype contexts, such as the <literal>Eq a</literal> in
132         </para>
133 <programlisting>
134 data Eq a => Set a = NilSet | ConsSet a (Set a)
135 </programlisting>
136         <para>
137           are now treated as an extension
138           <literal>DatatypeContexts</literal> (on by default) by GHC.
139         </para>
140       </listitem>
141
142       <listitem>
143         <para>
144           GHC's support for unicode source has been improved, including
145           removing support for U+22EF for the <literal>..</literal>
146           symbol. See <xref linkend="unicode-syntax" /> for more details.
147         </para>
148       </listitem>
149
150       <listitem>
151         <para>
152           Pragmas are now reread after preprocessing. In particular,
153           this means that if a pragma is used to turn CPP on, then other
154           pragmas can be put in CPP conditionals.
155         </para>
156       </listitem>
157
158       <listitem>
159         <para>
160           The <literal>TypeOperators</literal> extension now allows
161           instance heads to use infix syntax.
162         </para>
163       </listitem>
164
165       <listitem>
166         <para>
167           The <literal>PackageImports</literal> extension now understands
168           <literal>this</literal> to mean the current package.
169         </para>
170       </listitem>
171
172       <listitem>
173         <para>
174           The <literal>INLINE</literal> and <literal>NOINLINE</literal>
175           pragmas can now take a <literal>CONLIKE</literal> modifier,
176           which indicates that the right hand side is cheap to compute,
177           and can thus be duplicated more freely.
178           See <xref linkend="conlike" /> for more details.
179         </para>
180       </listitem>
181
182       <listitem>
183         <para>
184           A <literal>ForceSpecConstr</literal> annotation on a type, e.g.
185         </para>
186 <programlisting>
187 import SpecConstr
188 {-# ANN type SPEC ForceSpecConstr #-}
189 </programlisting>
190         <para>
191           can be used to force GHC to fully specialise argument of that
192           type.
193         </para>
194       </listitem>
195
196       <listitem>
197         <para>
198           A <literal>NoSpecConstr</literal> annotation on a type, e.g.
199         </para>
200 <programlisting>
201 import SpecConstr
202 {-# ANN type T NoSpecConstr #-}
203 </programlisting>
204         <para>
205           can be used to prevent SpecConstr from specialising on
206           arguments of that type.
207         </para>
208       </listitem>
209
210       <listitem>
211         <para>
212           There is are two experimental new extensions
213           <literal>AlternativeLayoutRule</literal> and
214           <literal>AlternativeLayoutRuleTransitional</literal>,
215           which are for exploring alternative layout rules in Haskell'.
216           The details are subject to change, so we advise against using
217           them in real code for now.
218         </para>
219       </listitem>
220
221       <listitem>
222         <para>
223           The <literal>NewQualifiedOperators</literal> extension has
224           been deprecated, as it was rejected by the Haskell' committee.
225         </para>
226       </listitem>
227     </itemizedlist>
228   </sect2>
229
230   <sect2>
231     <title>Warnings</title>
232     <itemizedlist>
233       <listitem>
234         <para>
235           There is now a warning for missing import lists, controlled
236           by the new <literal>-fwarn-missing-import-lists</literal> flag.
237         </para>
238       </listitem>
239
240       <listitem>
241         <para>
242           GHC will now warn about <literal>SPECIALISE</literal> and
243           <literal>UNPACK</literal> pragmas that have no effect.
244         </para>
245       </listitem>
246     </itemizedlist>
247   </sect2>
248
249   <sect2>
250     <title>DLLs</title>
251     <itemizedlist>
252       <listitem>
253         <para>
254           Shared libraries are once again supported on Windows.
255         </para>
256       </listitem>
257
258       <listitem>
259         <para>
260           Shared libraries are now supported on OS X, both on x86 and on
261           PowerPC. The new <literal>-dylib-install-name</literal> GHC
262           flag is used to set the location of the dynamic library.
263           See <xref linkend="finding-shared-libs" /> for more details.
264         </para>
265       </listitem>
266     </itemizedlist>
267   </sect2>
268
269   <sect2>
270     <title>Runtime system</title>
271
272     <itemizedlist>
273       <listitem>
274         <para>
275           For security reasons, by default, the only RTS flag that
276           programs accept is <literal>+RTS --info</literal>. If you want
277           the full range of RTS flags then you need to link with the new
278           <literal>-rtsopts</literal> flag. See
279           <xref linkend="options-linker" /> for more details.
280         </para>
281       </listitem>
282
283       <listitem>
284         <para>
285           The RTS now exports a function <literal>setKeepCAFs</literal>
286           which is important when loading Haskell DLLs dynamically, as
287           a DLL may refer to CAFs that hae already been GCed.
288         </para>
289       </listitem>
290
291       <listitem>
292         <para>
293           The garbage collector no longer allows you to specify a number
294           of steps; there are now always 2. The <literal>-T</literal>
295           RTS flag has thus been removed.
296         </para>
297       </listitem>
298
299       <listitem>
300         <para>
301           A new RTS flag <literal>-H</literal> causes the RTS to use a
302           larger nursery, but without exceeding the amount of memory
303           that the application is already using. It makes some programs
304           go slower, but others go faster.
305         </para>
306       </listitem>
307
308       <listitem>
309         <para>
310           GHC now returns memory to the OS, if memory usage peaks and
311           then drops again. This is mainly useful for long running
312           processes which normally use very little memory, but
313           occasionally need a lot of memory for a short period of time.
314         </para>
315       </listitem>
316
317       <listitem>
318         <para>
319           On OS X, eventLog events are now available as DTrace probes.
320         </para>
321       </listitem>
322
323       <listitem>
324         <para>
325           The PAPI support has been improved. The new RTS flag
326           <literal>-a#0x40000000</literal> can be used to tell the RTS
327           to collect the native PAPI event <literal>0x40000000</literal>.
328         </para>
329       </listitem>
330     </itemizedlist>
331   </sect2>
332
333   <sect2>
334     <title>Compiler</title>
335     <itemizedlist>
336       <listitem>
337         <para>
338           GHC now defaults to <literal>--make</literal> mode, i.e. GHC
339           will chase dependencies for you automatically by default.
340         </para>
341       </listitem>
342
343       <listitem>
344         <para>
345           GHC now includes an LLVM code generator.
346         </para>
347         <para>
348           This includes a number of new flags:
349           a flag to tell GHC to use LLVM, <literal>-fllvm</literal>;
350           a flag to dump the LLVM input ,<literal>-ddump-llvm</literal>;
351           flags to keep the LLVM intermediate files,
352           <literal>-keep-llvm-file</literal> and
353           <literal>-keep-llvm-files</literal>;
354           flags to set the location and options for the LLVM assembler,
355           optimiser and compiler,
356           <literal>-pgmla</literal>,
357           <literal>-pgmlo</literal>,
358           <literal>-pgmlc</literal>,
359           <literal>-optla</literal>,
360           <literal>-optlo</literal> and
361           <literal>-optlc</literal>.
362         </para>
363       </listitem>
364
365       <listitem>
366         <para>
367           It is now possible to use <literal>-fno-code</literal> with
368           <literal>--make</literal>.
369         </para>
370       </listitem>
371
372       <listitem>
373         <para>
374           The new flag <literal>-dsuppress-coercions</literal> controls
375           whether GHC prints coercions in core dumps.
376         </para>
377       </listitem>
378
379       <listitem>
380         <para>
381           The new flag <literal>-dsuppress-module-prefixes</literal>
382           controls whether GHC prints module qualification prefixes
383           in core dumps.
384         </para>
385       </listitem>
386
387       <listitem>
388         <para>
389           The inliner has been overhauled. The most significant
390           user-visible change is that only saturated functions are
391           inlined, e.g.
392         </para>
393 <programlisting>
394 (.) f g x = f (g x)
395 </programlisting>
396         <para>
397           would only be inlined if <literal>(.)</literal> is applied to 3
398           arguments, while
399         </para>
400 <programlisting>
401 (.) f g = \x -> f (g x)
402 </programlisting>
403         <para>
404           will be inlined if only applied to 2 arguments.
405         </para>
406       </listitem>
407
408       <listitem>
409         <para>
410           The <literal>-finline-if-enough-args</literal> flag is no
411           longer supported.
412         </para>
413       </listitem>
414
415       <listitem>
416         <para>
417           Column numbers in warnings and error messages now start at 1,
418           as is more standard, rather than 0.
419         </para>
420       </listitem>
421
422       <listitem>
423         <para>
424           GHCi now understands most linker scripts. In particular, this
425           means that GHCi is able to load the C pthread library.
426         </para>
427       </listitem>
428
429       <listitem>
430         <para>
431           The <literal>ghc --info</literal> output has been updated:
432         </para>
433         <para>
434           It now includes the
435           location of the global package database, in the
436           <literal>Global Package DB</literal> field.
437         </para>
438         <para>
439           It now includes the build, host and target platforms, in the
440           <literal>Build platform</literal>,
441           <literal>Host platform</literal> and
442           <literal>Target platform</literal> fields.
443         </para>
444         <para>
445           It now includes a <literal>Have llvm code generator</literal>
446           field.
447         </para>
448         <para>
449           The <literal>Win32 DLLs</literal> field has been removed.
450         </para>
451       </listitem>
452
453       <listitem>
454         <para>
455           The registerised via-C backend, and the
456           <literal>-fvia-C</literal> flag, have been deprecated. The poor
457           floating-point performance in the x86 native code generator
458           has now been fixed, so we don't believe there is still any
459           reason to use the via-C backend.
460         </para>
461       </listitem>
462
463       <listitem>
464         <para>
465           There is now a new flag <literal>--supported-extensions</literal>,
466           which currently behaves the same as
467           <literal>--supported-languages</literal>.
468         </para>
469       </listitem>
470
471       <listitem>
472         <para>
473           GHC progress output such as
474         </para>
475 <programlisting>
476 [ 1 of 5] Compiling Foo              ( Foo.hs, Foo.o )
477 </programlisting>
478         <para>
479           is now sent to stdout rather than stderr.
480         </para>
481       </listitem>
482
483       <listitem>
484         <para>
485           The new flag <literal>-fexpose-all-unfoldings</literal>
486           makes GHC put unfoldings for <emphasis>everything</emphasis>
487           in the interface file.
488         </para>
489       </listitem>
490
491       <listitem>
492         <para>
493           There are two new flags, <literal>-fno-specialise</literal>
494           and <literal>-fno-float-in</literal>, for disabling the
495           specialise and float-in passes.
496         </para>
497       </listitem>
498
499       <listitem>
500         <para>
501           The new flag <literal>-fstrictness-before=<replaceable>n</replaceable></literal> tells
502           GHC to run an additional strictness analysis pass
503           before simplifier phase <replaceable>n</replaceable>.
504         </para>
505       </listitem>
506
507       <listitem>
508         <para>
509           There is a new flag
510           <literal>-funfolding-dict-discount</literal>
511           for tweaking the optimiser's behaviour.
512         </para>
513       </listitem>
514
515       <listitem>
516         <para>
517           The <literal>-fspec-inline-join-points</literal> flag has been
518           removed.
519         </para>
520       </listitem>
521     </itemizedlist>
522   </sect2>
523
524   <sect2>
525     <title>GHCi</title>
526     <itemizedlist>
527       <listitem>
528         <para>
529           GHCi now understands layout in multi-line commands, so
530           this now works:
531         </para>
532 <programlisting>
533 Prelude> :{
534 Prelude| let x = 1
535 Prelude|     y = 2 in x + y
536 Prelude| :}
537 3
538 </programlisting>
539       </listitem>
540     </itemizedlist>
541   </sect2>
542
543   <sect2>
544     <title>Template Haskell and Quasi-Quoters</title>
545     <itemizedlist>
546       <listitem>
547         <para>
548           It is now possible to quasi-quote patterns with
549           <literal>[p| ... |]</literal>.
550         </para>
551       </listitem>
552
553       <listitem>
554         <para>
555           It is no longer to use a <literal>$</literal> before the
556           name of a quasi-quoter, e.g. one can now say
557           <literal>[expr| ... |]</literal> rather than
558           <literal>[$expr| ... |]</literal>.
559         </para>
560       </listitem>
561
562       <listitem>
563         <para>
564           It is now possible to use a quasi-quoter for types, e.g.
565           <literal>f :: [$qq| ... |]</literal>
566         </para>
567       </listitem>
568
569       <listitem>
570         <para>
571           It is now possible to quasi-quote existentials and GADTs.
572         </para>
573       </listitem>
574     </itemizedlist>
575   </sect2>
576
577   <sect2>
578     <title>GHC API</title>
579     <itemizedlist>
580       <listitem>
581         <para>
582           There are now <literal>Data</literal> and
583           <literal>Typeable</literal> instances for the
584           HsSyn typed.
585         </para>
586       </listitem>
587
588       <listitem>
589         <para>
590           As language extensions are not applied until after the base
591           language (Haskell98, Haskell2010 or the default) has been
592           selected, it is now necessary to tell the GHC API the point
593           at which the extension flags should be processed. Normally
594           this is done by calling
595           <literal>DynFlags.flattenExtensionFlags</literal> once all
596           the flags and pragmas have been read.
597         </para>
598       </listitem>
599     </itemizedlist>
600   </sect2>
601
602 <!--
603   <sect2>
604     <title>Libraries</title>
605
606     <itemizedlist>
607     </itemizedlist>
608   </sect2>
609 -->
610 </sect1>
611