52f3e7ca1ba86cbb4903aabb2bc7180633dc9f12
[ghc.git] / docs / users_guide / 7.8.1-notes.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <sect1 id="release-7-8-1">
3 <title>Release notes for version 7.8.1</title>
4
5 <para>
6 The significant changes to the various parts of the compiler are listed
7 in the following sections. There have also been numerous bug fixes and
8 performance improvements over the 7.6 branch.
9 </para>
10
11 <sect2>
12 <title>Highlights</title>
13
14 <para>
15 The highlights, since the 7.6 branch, are:
16 </para>
17
18 <itemizedlist>
19 <listitem>
20 <para>
21 GHC now supports "type holes" with the
22 <literal>TypeHoles</literal> extension. When enabled, the
23 unbound literal <literal>_</literal> may be used during
24 development in place of a regular identifier, and GHC will
25 respond with the type necessary to "fill in the hole."
26
27 TODO FIXME: reference.
28 </para>
29 </listitem>
30
31 <listitem>
32 <para>
33 GHC can now perform simple evaluation of type-level
34 natural numbers, when using the
35 <literal>DataKinds</literal> extension. For example,
36 given a type-level constraint such as <literal>(x + 3)
37 ~ 5</literal>, GHC is able to infer that
38 <literal>x</literal> is 2. Similarly, GHC can now
39 understand type-level identities such as <literal>x +
40 0 ~ x</literal>.
41 </para>
42
43 <para>
44 Note that the solving of these equations is only used
45 to resolve unification variables - it does not
46 generate new facts in the type checker. This is
47 similar to how functional dependencies work.
48 </para>
49 </listitem>
50
51 <listitem>
52 <para>
53 It is now possible to declare a 'closed' <literal>type
54 family</literal> when using the
55 <literal>TypeFamilies</literal> extension. A closed
56 <literal>type family</literal> cannot have any
57 instances created other than the ones in its
58 definition.
59
60 TODO FIXME: reference.
61 </para>
62 </listitem>
63
64 <listitem>
65 <para>
66 Use of the <literal>GeneralizedNewtypeDeriving</literal>
67 extension is now subject to <emphasis>role checking</emphasis>,
68 to ensure type safety of the derived instances. As this change
69 increases the type safety of GHC, it is possible that some code
70 that previously compiled will no longer work.
71
72 TODO FIXME: reference.
73 </para>
74 </listitem>
75
76 <listitem>
77 <para>
78 GHC now supports overloading list literals using the new
79 <literal>OverloadedLists</literal> extension.
80
81 TODO FIXME: reference.
82 </para>
83 </listitem>
84
85 <listitem>
86 <para>
87 There has been significant overhaul of the type inference engine and
88 constraint solver.
89
90 TODO FIXME: reference.
91 </para>
92 </listitem>
93
94 <listitem>
95 <para>
96 By default, GHC will now unbox all "small" strict
97 fields in a data type. A "small" data type is one
98 whose size is equivalent to or smaller than the native
99 word size of the machine. This means you no longer
100 have to specify <literal>UNPACK</literal> pragmas for
101 e.g. strict <literal>Int</literal> fields. This also
102 applies to floating-point values.
103 </para>
104 </listitem>
105
106 <listitem>
107 <para>
108 GHC now has a brand-new I/O manager that scales significantly
109 better for larger workloads compared to the previous one. It
110 should scale linearly up to approximately 32 cores.
111 </para>
112 </listitem>
113
114 <listitem>
115 <para>
116 The LLVM backend now supports 128bit SIMD
117 operations. This is now exploited in both the
118 <literal>vector</literal> and <literal>dph</literal>
119 packages, exposing a high level interface.
120
121 TODO FIXME: reference.
122 </para>
123 <para>
124 This is only available with the LLVM backend.
125 </para>
126 </listitem>
127
128 <listitem>
129 <para>
130 The new code generator, after significant work by many
131 individuals over the past several years, is now enabled by
132 default. This is a complete rewrite of the STG to Cmm
133 transformation. In general, your programs may get slightly
134 faster.
135 </para>
136
137 <para>
138 The old code generator has been removed completely.
139 </para>
140 </listitem>
141
142 <listitem>
143 <para>
144 GHC now has substantially better support for cross
145 compilation. In particular, GHC now has all the
146 necessary patches to support cross compilation to
147 Apple iOS, using the LLVM backend.
148
149 TODO FIXME: reference.
150 </para>
151 </listitem>
152
153 <listitem>
154 <para>
155 PrimOps for comparing unboxed values now return
156 <literal>Int#</literal> instead of <literal>Bool</literal>.
157 This change is backwards incompatible. See
158 <ulink url="http://ghc.haskell.org/trac/ghc/wiki/NewPrimopsInGHC7.8">
159 this GHC wiki page</ulink> for instructions how to update your
160 existing code. See <ulink url="http://ghc.haskell.org/trac/ghc/wiki/PrimBool">
161 here</ulink> for motivation and discussion of implementation details.
162 </para>
163 </listitem>
164
165 <listitem>
166 <para>
167 New PrimOps for atomic memory operations.
168 The <literal>casMutVar#</literal> PrimOp was introduced in
169 GHC 7.2 (debugged in 7.4). This release also includes additional
170 PrimOps for compare-and-swap (<literal>casArray#</literal> and
171 <literal>casIntArray#</literal>) and one for fetch-and-add
172 (<literal>fetchAddIntArray#</literal>).
173 </para>
174 </listitem>
175
176 <listitem>
177 <para>
178 TODO: mention dynamic changes
179 </para>
180 </listitem>
181
182 <listitem>
183 <para>
184 <literal>Typeable</literal> is now poly-kinded, making
185 <literal>Typeable1</literal>, <literal>Typeable2</literal>,
186 etc., obsolete, deprecated, and relegated to
187 <literal>Data.OldTypeable</literal>. Furthermore, user-written
188 instances of <literal>Typeable</literal> are now disallowed:
189 use <literal>deriving</literal> or the new extension
190 <literal>-XAutoDeriveTypeable</literal>, which will create
191 <literal>Typeable</literal> instances for every datatype
192 declared in the module.
193 </para>
194 </listitem>
195
196 <listitem>
197 <para>
198 GHC now has a parallel compilation driver. When
199 compiling with <literal>--make</literal> (which is on
200 by default,) you may also specify
201 <literal>-jN</literal> in order to compile
202 <replaceable>N</replaceable> modules in parallel.
203 </para>
204 </listitem>
205
206 <listitem>
207 <para>
208 GHC now has support for a new pragma,
209 <literal>{-# MINIMAL #-}</literal>, allowing you to
210 explicitly declare the minimal complete definition of
211 a class. Should an instance not provide the minimal
212 required definitions, a warning will be emitted.
213 </para>
214 </listitem>
215
216 <listitem>
217 <para>
218 GHC now generates warnings when definitions conflict with the
219 Applicative-Monad Proposal (AMP).
220
221 TODO FIXME: reference.
222 </para>
223
224 <para>
225 A warning is emitted if a type is an instance of
226 <literal>Monad</literal> but not of
227 <literal>Applicative</literal>,
228 <literal>MonadPlus</literal> but not
229 <literal>Alternative</literal>, and when a local
230 function named <literal>join</literal>,
231 <literal>&lt;*&gt;</literal> or <literal>pure</literal> is
232 defined.
233 </para>
234
235 <para>
236 The warnings are enabled by default, and can be controlled
237 using the new flag <literal>-f[no-]warn-amp</literal>.
238 </para>
239 </listitem>
240 <listitem>
241 <para>
242 GHC's internal compiler pipeline is now exposed
243 through a <literal>Hooks</literal> module inside the
244 GHC API. These hooks allow you to control most of the
245 internal compiler phase machinery, including compiling
246 expressions, phase control, and linking.
247 </para>
248
249 <para>
250 Note: this interface will likely see continuous
251 refinment and API changes in future releases, so it
252 should be considered a preview.
253 </para>
254 </listitem>
255 </itemizedlist>
256 </sect2>
257
258 <sect2>
259 <title>Full details</title>
260 <sect3>
261 <title>Language</title>
262 <itemizedlist>
263 <listitem>
264 <para>
265 There is a new extension,
266 <literal>NullaryTypeClasses</literal>, which
267 allows you to declare a type class without any
268 parameters.
269 </para>
270 </listitem>
271 </itemizedlist>
272
273 <itemizedlist>
274 <listitem>
275 <para>
276 There is a new extension,
277 <literal>NumDecimals</literal>, which allows you
278 to specify an integer using compact "floating
279 literal" syntax. This lets you say things like
280 <literal>1.2e6 :: Integer</literal> instead of
281 <literal>1200000</literal>
282 </para>
283 </listitem>
284 </itemizedlist>
285
286 <itemizedlist>
287 <listitem>
288 <para>
289 There is a new extension,
290 <literal>NegativeLiterals</literal>, which will
291 cause GHC to interpret the expression
292 <literal>-123</literal> as <literal>fromIntegral
293 (-123)</literal>. Haskell 98 and Haskell 2010 both
294 specify that it should instead desugar to
295 <literal>negate (fromIntegral 123)</literal>
296 </para>
297 </listitem>
298 </itemizedlist>
299
300 <itemizedlist>
301 <listitem>
302 <para>
303 The <literal>IncoherentInstances</literal>
304 extension has seen a behavioral change, and is
305 now 'liberated' and less conservative during
306 instance resolution. This allows more programs to
307 compile than before.
308 </para>
309 <para>
310 Now, <literal>IncoherentInstances</literal> will
311 always pick an arbitrary matching instance, if
312 multiple ones exist.
313 </para>
314 </listitem>
315 </itemizedlist>
316
317 <itemizedlist>
318 <listitem>
319 <para>
320 A new built-in function <literal>coerce</literal> is
321 provided that allows to safely coerce values between types
322 that have the same run-time-presentation, such as
323 newtypes, but also newtypes inside containers. See the
324 haddock documentation of
325 <ulink url="&libraryBaseLocation;/GHC-Exts.html#v%3Acoerce">coerce</ulink>
326 and of the class
327 <ulink url="&libraryBaseLocation;/GHC-Exts.html#t%3ACoercible">Coercible</ulink>
328 for more details.
329 </para>
330 <para>
331 This feature is included in this release as a technology
332 preview, and may change its syntax and/or semantics in the
333 next release.
334 </para>
335 </listitem>
336 </itemizedlist>
337
338 <itemizedlist>
339 <listitem>
340 <para>
341 The new pragma, <literal>{-# MINIMAL #-}</literal>,
342 allows to explicitly declare the minimal complete
343 definition of a class. Should an instance not provide
344 the minimal required definitions, a warning will be
345 emitted.
346 </para>
347
348 <para>
349 See <xref linkend="minimal-pragma"/> for more details.
350 </para>
351 </listitem>
352 </itemizedlist>
353 </sect3>
354
355 <sect3>
356 <title>Compiler</title>
357 <itemizedlist>
358 <listitem>
359 <para>
360 GHC can now build both static and dynamic object
361 files at the same time in a single compilation
362 pass, when given the
363 <literal>-dynamic-too</literal> flag. This will
364 produce both a statically-linkable
365 <literal>.o</literal> object file, and a
366 dynamically-linkable <literal>.dyn_o</literal>
367 file. The output suffix of the dynamic objects can
368 be controlled by the flag
369 <literal>-dynosuf</literal>.
370 </para>
371
372 <para>
373 Note that GHC still builds statically by default.
374 </para>
375 </listitem>
376 <listitem>
377 <para>
378 GHC now supports a <literal>--show-options</literal> flag,
379 which will dump all of the flags it supports to standard out.
380 </para>
381 </listitem>
382 <listitem>
383 <para>
384 GHC now supports warning about overflow of integer
385 literals, enabled by
386 <literal>-fwarn-overflowed-literals</literal>. It
387 is enabled by default
388 </para>
389 </listitem>
390 <listitem>
391 <para>
392 It's now possible to switch the system linker on Linux
393 (between GNU gold and GNU ld) at runtime without problem.
394 </para>
395 </listitem>
396 <listitem>
397 <para>
398 The <literal>-fwarn-dodgy-imports</literal> flag now warns
399 in the case an <literal>import</literal> statement hides an
400 entity which is not exported.
401 </para>
402 </listitem>
403 <listitem>
404 <para>
405 The LLVM backend was overhauled and rewritten, and
406 should hopefully be easier to maintain and work on
407 in the future.
408 </para>
409 </listitem>
410 </itemizedlist>
411 </sect3>
412
413 <sect3>
414 <title>GHCi</title>
415 <itemizedlist>
416 <listitem>
417 <para>
418 GHCi now supports a <literal>prompt2</literal>
419 setting, which allows you to customize the
420 continuation prompt of multi-line input.
421
422 TODO FIXME: reference.
423 </para>
424 </listitem>
425 <listitem>
426 <para>
427 The new <literal>:shows paths</literal> command
428 shows the current working directory and the
429 current search path for Haskell modules.
430 </para>
431 </listitem>
432
433 <listitem>
434 <para>
435 The GHCi linker now runs constructors for linked
436 libraries. This means for example that C code
437 using
438 <literal>__attribute__((constructor))</literal>
439 can now properly be loaded into GHCi.
440 </para>
441
442 <para>
443 Note: destructors are not supported.
444 </para>
445 </listitem>
446 </itemizedlist>
447 </sect3>
448
449 <sect3>
450 <title>Template Haskell</title>
451 <itemizedlist>
452 <listitem>
453 <para>
454 TODO FIXME
455 </para>
456 </listitem>
457 </itemizedlist>
458 </sect3>
459
460 <sect3>
461 <title>Runtime system</title>
462 <itemizedlist>
463 <listitem>
464 <para>
465 The RTS linker can now unload object code at
466 runtime (when using the GHC API
467 <literal>ObjLink</literal> module.) Previously,
468 GHC would not unload the old object file, causing
469 a gradual memory leak as more objects were loaded
470 over time.
471 </para>
472
473 <para>
474 Note that this change in unloading behavior
475 <emphasis>only</emphasis> affects statically
476 linked binaries, and not dynamic ones.
477 </para>
478 </listitem>
479
480 <listitem>
481 <para>
482 The performance of <literal>StablePtr</literal>s and
483 <literal>StableName</literal>s has been improved.
484 </para>
485 </listitem>
486 </itemizedlist>
487 </sect3>
488
489 <sect3>
490 <title>Build system</title>
491 <itemizedlist>
492 <listitem>
493 <para>
494 GHC >= 7.4 is now required for bootstrapping.
495 </para>
496 </listitem>
497 <listitem>
498 <para>
499 GHC can now be built with Clang, and use Clang as the
500 preprocessor for Haskell code. Only Clang version 3.4svn is
501 reliably supported.
502 </para>
503 </listitem>
504 </itemizedlist>
505 </sect3>
506 </sect2>
507
508 <sect2>
509 <title>Libraries</title>
510
511 <para>
512 There have been some changes that have effected multiple
513 libraries:
514 </para>
515
516 <itemizedlist>
517 <listitem>
518 <para>
519 TODO FIXME
520 </para>
521 </listitem>
522 </itemizedlist>
523
524 <para>
525 The following libraries have been removed from the GHC tree:
526 </para>
527
528 <itemizedlist>
529 <listitem>
530 <para>TODO FIXME</para>
531 </listitem>
532 </itemizedlist>
533
534 <para>
535 The following libraries have been added to the GHC tree:
536 </para>
537
538 <itemizedlist>
539 <listitem>
540 <para>TODO FIXME</para>
541 </listitem>
542 </itemizedlist>
543
544 <sect3>
545 <title>array</title>
546 <itemizedlist>
547 <listitem>
548 <para>
549 Version number XXXX (was XXXX)
550 </para>
551 </listitem>
552 </itemizedlist>
553 </sect3>
554
555 <sect3>
556 <title>base</title>
557 <itemizedlist>
558 <listitem>
559 <para>
560 Version number 4.7.0.0 (was 4.6.0.1)
561 </para>
562 </listitem>
563 <listitem>
564 <para>
565 The <literal>Control.Category</literal> module now has the
566 <literal>PolyKinds</literal> extension enabled, meaning
567 that instances of <literal>Category</literal> no longer
568 need be of kind <literal>* -> * -> *</literal>
569 </para>
570 </listitem>
571 <listitem>
572 <para>
573 There are now <literal>Foldable</literal> and <literal>Traversable</literal>
574 instances for <literal>Either a</literal> and <literal>(,) a</literal>
575 </para>
576 </listitem>
577 <listitem>
578 <para>
579 There is now a <literal>Data</literal> instance for <literal>Data.Version</literal>
580 </para>
581 </listitem>
582 <listitem>
583 <para>
584 <literal>Control.Concurrent.MVar</literal> has a new
585 implementation of <literal>readMVar</literal>, which
586 fixes a long-standing bug where
587 <literal>readMVar</literal> is only atomic if there
588 are no other threads running
589 <literal>putMVar</literal>.
590 <literal>readMVar</literal> now is atomic, and is
591 guaranteed to return the value from the first
592 <literal>putMVar</literal>. There is also a new <literal>tryReadMVar</literal>
593 which is a non-blocking version.
594 </para>
595 </listitem>
596 <listitem>
597 <para>
598 There are now byte endian-swapping primitives
599 available in <literal>Data.Word</literal>, which
600 use optimized machine instructions when available.
601 </para>
602 </listitem>
603 <listitem>
604 <para>
605 <literal>Data.Bool</literal> now exports
606 <literal>bool :: a -> a -> Bool -> a</literal>, analogously
607 to <literal>maybe</literal> and <literal>either</literal>
608 in their respective modules.
609 </para>
610 </listitem>
611 <listitem>
612 <para>
613 Rewrote portions of <literal>Text.Printf</literal>, and
614 made changes to <literal>Numeric</literal> (added
615 <literal>Numeric.showFFloatAlt</literal> and
616 <literal>Numeric.showGFloatAlt</literal>) and
617 <literal>GHC.Float</literal> (added
618 <literal>formatRealFloatAlt</literal>) to support it.
619 The rewritten version is extensible to user types, adds a
620 "generic" format specifier "<literal>%v</literal>",
621 extends the <literal>printf</literal> spec
622 to support much of C's <literal>printf(3)</literal>
623 functionality, and fixes the spurious warnings about
624 using <literal>Text.Printf.printf</literal> at
625 <literal>(IO a)</literal> while ignoring the return value.
626 These changes were contributed by Bart Massey.
627 </para>
628 </listitem>
629 <listitem>
630 <para>
631 The minimal complete definitions for all
632 type-classes with cyclic default implementations
633 have been explicitly annotated with the new
634 <literal>{-# MINIMAL #-}</literal> pragma.
635 </para>
636 </listitem>
637 <listitem>
638 <para>
639 <literal>Control.Applicative.WrappedMonad</literal>,
640 which can be used to convert a <literal>Monad</literal>
641 to an <literal>Applicative</literal>, has now
642 a <literal>Monad m => Monad (WrappedMonad m)</literal>
643 instance.
644 </para>
645 </listitem>
646 </itemizedlist>
647 </sect3>
648
649 <sect3>
650 <title>bin-package-db</title>
651 <itemizedlist>
652 <listitem>
653 <para>
654 This is an internal package, and should not be used.
655 </para>
656 </listitem>
657 </itemizedlist>
658 </sect3>
659
660 <sect3>
661 <title>binary</title>
662 <itemizedlist>
663 <listitem>
664 <para>
665 Version number XXXX (was XXXX)
666 </para>
667 </listitem>
668 </itemizedlist>
669 </sect3>
670
671 <sect3>
672 <title>bytestring</title>
673 <itemizedlist>
674 <listitem>
675 <para>
676 Version number XXXX (was XXXX)
677 </para>
678 </listitem>
679 </itemizedlist>
680 </sect3>
681
682 <sect3>
683 <title>Cabal</title>
684 <itemizedlist>
685 <listitem>
686 <para>
687 Version number XXXX (was XXXX)
688 </para>
689 </listitem>
690 </itemizedlist>
691 </sect3>
692
693 <sect3>
694 <title>containers</title>
695 <itemizedlist>
696 <listitem>
697 <para>
698 Version number XXXX (was XXXX)
699 </para>
700 </listitem>
701 </itemizedlist>
702 </sect3>
703
704 <sect3>
705 <title>deepseq</title>
706 <itemizedlist>
707 <listitem>
708 <para>
709 Version number XXXX (was XXXX)
710 </para>
711 </listitem>
712 </itemizedlist>
713 </sect3>
714
715 <sect3>
716 <title>directory</title>
717 <itemizedlist>
718 <listitem>
719 <para>
720 Version number XXXX (was XXXX)
721 </para>
722 </listitem>
723 </itemizedlist>
724 </sect3>
725
726 <sect3>
727 <title>filepath</title>
728 <itemizedlist>
729 <listitem>
730 <para>
731 Version number XXXX (was XXXX)
732 </para>
733 </listitem>
734 </itemizedlist>
735 </sect3>
736
737 <sect3>
738 <title>ghc-prim</title>
739 <itemizedlist>
740 <listitem>
741 <para>
742 Version number XXXX (was XXXX)
743 </para>
744 </listitem>
745 <listitem>
746 <para>
747 The type-classes <literal>Eq</literal> and
748 <literal>Ord</literal> have been annotated with
749 the new <literal>{-# MINIMAL #-}</literal>
750 pragma.
751 </para>
752 </listitem>
753 </itemizedlist>
754 </sect3>
755
756 <sect3>
757 <title>haskell98</title>
758 <itemizedlist>
759 <listitem>
760 <para>
761 Version number XXXX (was XXXX)
762 </para>
763 </listitem>
764 </itemizedlist>
765 </sect3>
766
767 <sect3>
768 <title>haskell2010</title>
769 <itemizedlist>
770 <listitem>
771 <para>
772 Version number XXXX (was XXXX)
773 </para>
774 </listitem>
775 </itemizedlist>
776 </sect3>
777
778 <sect3>
779 <title>hoopl</title>
780 <itemizedlist>
781 <listitem>
782 <para>
783 Version number XXXX (was XXXX)
784 </para>
785 </listitem>
786 </itemizedlist>
787 </sect3>
788
789 <sect3>
790 <title>hpc</title>
791 <itemizedlist>
792 <listitem>
793 <para>
794 Version number XXXX (was XXXX)
795 </para>
796 </listitem>
797 </itemizedlist>
798 </sect3>
799
800 <sect3>
801 <title>integer-gmp</title>
802 <itemizedlist>
803 <listitem>
804 <para>
805 Version number XXXX (was XXXX)
806 </para>
807 </listitem>
808 </itemizedlist>
809 </sect3>
810
811 <sect3>
812 <title>old-locale</title>
813 <itemizedlist>
814 <listitem>
815 <para>
816 Version number XXXX (was XXXX)
817 </para>
818 </listitem>
819 </itemizedlist>
820 </sect3>
821
822 <sect3>
823 <title>old-time</title>
824 <itemizedlist>
825 <listitem>
826 <para>
827 Version number XXXX (was XXXX)
828 </para>
829 </listitem>
830 </itemizedlist>
831 </sect3>
832
833 <sect3>
834 <title>process</title>
835 <itemizedlist>
836 <listitem>
837 <para>
838 Version number XXXX (was XXXX)
839 </para>
840 </listitem>
841 </itemizedlist>
842 </sect3>
843
844 <sect3>
845 <title>template-haskell</title>
846 <itemizedlist>
847 <listitem>
848 <para>
849 Version number XXXX (was XXXX)
850 </para>
851 </listitem>
852 </itemizedlist>
853 </sect3>
854
855 <sect3>
856 <title>time</title>
857 <itemizedlist>
858 <listitem>
859 <para>
860 Version number XXXX (was XXXX)
861 </para>
862 </listitem>
863 </itemizedlist>
864 </sect3>
865
866 <sect3>
867 <title>unix</title>
868 <itemizedlist>
869 <listitem>
870 <para>
871 Version number 2.7.0.0 (was 2.6.0.0)
872 </para>
873 </listitem>
874 <listitem>
875 <para>
876 A crash in <literal>getGroupEntryForID</literal>
877 (and related functions like
878 <literal>getUserEntryForID</literal> and
879 <literal>getUserEntryForName</literal>) in
880 multi-threaded applications has been fixed.
881 </para>
882 </listitem>
883 <listitem>
884 <para>
885 The functions <literal>getGroupEntryForID</literal>
886 and <literal>getUserEntryForID</literal> now fail
887 with a <literal>isDoesNotExist</literal> error when
888 the specified ID cannot be found.
889 </para>
890 </listitem>
891 </itemizedlist>
892 </sect3>
893
894 <sect3>
895 <title>Win32</title>
896 <itemizedlist>
897 <listitem>
898 <para>
899 Version number XXXX (was XXXX)
900 </para>
901 </listitem>
902 </itemizedlist>
903 </sect3>
904 </sect2>
905 </sect1>