Forbid annotations when Safe Haskell safe mode is enabled.
[ghc.git] / docs / users_guide / 7.12.1-notes.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <sect1 id="release-7-12-1">
3 <title>Release notes for version 7.12.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.10 branch.
9 </para>
10
11 <sect2>
12 <title>Highlights</title>
13
14 <para>
15 The highlights, since the 7.10 branch, are:
16 </para>
17
18 <itemizedlist>
19 <listitem>
20 <para>
21 TODO FIXME
22 </para>
23 </listitem>
24 </itemizedlist>
25 </sect2>
26
27 <sect2>
28 <title>Full details</title>
29 <sect3>
30 <title>Language</title>
31 <itemizedlist>
32 <listitem>
33 <para>
34 TODO FIXME.
35 </para>
36 </listitem>
37
38 <listitem>
39 <para>
40 The parser now supports Haddock comments on GADT data constructors. For example,
41 <programlisting>
42 data Expr a where
43 -- | Just a normal sum
44 Sum :: Int -> Int -> Expr Int
45 </programlisting>
46 </para>
47 </listitem>
48 <listitem>
49 <para>
50 Implicit parameters of the new ghc-prim type
51 <literal>GHC.Types.CallStack</literal> are treated
52 specially, and automatically solved for the current source
53 location. For example
54 <programlisting>
55 f = print (?stk :: CallStack)
56 </programlisting>
57 will print the singleton stack containing the occurrence of
58 <literal>?stk</literal>. If there is another
59 <literal>CallStack</literal> implicit in-scope, the new location
60 will be appended to the existing stack, e.g.
61 <programlisting>
62 f :: (?stk :: CallStack) => IO ()
63 f = print (?stk :: CallStack)
64 </programlisting>
65 will print the occurrence of <literal>?stk</literal> and the
66 call-site of <literal>f</literal>. The name of the implicit
67 parameter does not matter.
68 </para>
69 <para>
70 See the release notes for ghc-prim for a description of the
71 <literal>CallStack</literal> type.
72 </para>
73 </listitem>
74
75 <listitem>
76 <para>
77 To conform to the common case, the default role assigned to parameters
78 of datatypes declared in <literal>hs-boot</literal> files is
79 <literal>representational</literal>. However, if the constructor(s)
80 for the datatype are given, it makes sense to do normal role inference.
81 This is now implemented, effectively making the default role for
82 non-abstract datatypes in <literal>hs-boot</literal> files to be
83 <literal>phantom</literal>, like it is in regular Haskell code.
84 </para>
85 </listitem>
86 <listitem>
87 <para>
88 Wildcards can be used in the type arguments of type/data
89 family instance declarations to indicate that the name of a
90 type variable doesn't matter. They will be replaced with new
91 unique type variables. See <xref
92 linkend="data-instance-declarations"/> for more details.
93 </para>
94 </listitem>
95
96 <listitem>
97 <para>
98 GHC now allows to declare type families as injective.
99 Injectivity information can then be used by the typechecker.
100 See <xref linkend="injective-ty-fams"/> for details.
101 </para>
102 </listitem>
103
104 <listitem>
105 <para>
106 Due to a <ulink href="https://ghc.haskell.org/trac/ghc/ticket/10826">
107 security issue
108 </ulink>, Safe Haskell now forbids annotations in programs marked as
109 <literal>-XSafe</literal>
110 </para>
111 </listitem>
112 </itemizedlist>
113 </sect3>
114
115 <sect3>
116 <title>Compiler</title>
117 <itemizedlist>
118 <listitem>
119 <para>
120 Added the option <option>-dth-dec-file</option>.
121
122 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.
123 This is similar to using <option>-ddump-to-file</option> with <option>-ddump-splices</option> but it always generates a file instead of being coupled to <option>-ddump-to-file</option> and only outputs code that does not exist in the .hs file and a comment for the splice location in the original file.
124 </para>
125 </listitem>
126 <listitem>
127 <para>
128 Added the option <option>-fprint-expanded-types</option>.
129
130 When enabled, GHC also prints type-synonym-expanded types in
131 type errors.
132 </para>
133 </listitem>
134 <listitem>
135 <para>
136 Added the option <option>-fcpr-anal</option>.
137
138 When enabled, the demand analyser performs CPR analysis.
139 It is implied by <option>-O</option>. Consequently,
140 <option>-fcpr-off</option> is now removed, run with
141 <option>-fno-cpr-anal</option> to get the old
142 <option>-fcpr-off</option> behaviour.
143 </para>
144 </listitem>
145 </itemizedlist>
146 </sect3>
147
148 <sect3>
149 <title>GHCi</title>
150 <itemizedlist>
151 <listitem>
152 <para>
153 <literal>Main</literal> with an explicit module header but
154 without <literal>main</literal> is now an error (#7765).
155 </para>
156 <para>
157 The <literal>:back</literal> and <literal>:forward</literal>
158 commands now take an optional count allowing the user to move forward or
159 backward in history several steps at a time.
160 </para>
161 <para>
162 Added commands <literal>:load!</literal> and <literal>:reload!</literal>,
163 effectively setting "-fdefer-type-errors" before loading a module and
164 unsetting it after loading if it has not been set before (#8353).
165 </para>
166 </listitem>
167 </itemizedlist>
168 </sect3>
169
170 <sect3>
171 <title>Template Haskell</title>
172 <itemizedlist>
173 <listitem>
174 <para>
175 The <literal>TemplateHaskell</literal> now no longer automatically
176 errors when used with a stage 1 compiler (i.e. GHC without
177 interpreter support); in particular, plain
178 Haskell quotes (not quasi-quotes) can now be compiled without erroring.
179 Splices and quasi-quotes continue to only be supported by a
180 stage 2 compiler.
181 </para>
182 </listitem>
183 <listitem>
184 <para>
185 Partial type signatures can now be used in splices, see <xref linkend="pts-where"/>.
186 </para>
187 </listitem>
188 <listitem>
189 <para>
190 <literal>Template Haskell</literal> now supports the use of
191 <literal>UInfixT</literal> in types to resolve infix
192 operator fixities, in the same vein as
193 <literal>UInfixP</literal> and <literal>UInfixE</literal>
194 in patterns and expressions. <literal>ParensT</literal>
195 and <literal>InfixT</literal> have also been introduced,
196 serving the same functions as their pattern and expression
197 counterparts.
198 </para>
199 </listitem>
200 <listitem>
201 <para>
202 Primitive chars (e.g., <literal>[| 'a'# |]</literal>) and
203 primitive strings (e.g., <literal>[| "abc"# |]</literal>)
204 can now be quoted with Template Haskell. The
205 <literal>Lit</literal> data type also has a new
206 constructor, <literal>CharPrimL</literal>, for primitive
207 char literals.
208 </para>
209 </listitem>
210 <listitem>
211 <para>
212 <literal>addTopDecls</literal> now accepts annotation
213 pragmas.
214 </para>
215 </listitem>
216 <listitem>
217 <para>
218 Internally, the implementation of quasi-quotes has been
219 unified with that of normal Template Haskell splices. Under
220 the previous implementation, top-level declaration
221 quasi-quotes did not cause a break in the declaration
222 groups, unlike splices of the form
223 <literal>$(...)</literal>. This behavior has been
224 preserved under the new implementation, and is now
225 recognized and documented in <xref linked="th-syntax"/>.
226 </para>
227 </listitem>
228 </itemizedlist>
229 </sect3>
230
231 <sect3>
232 <title>Runtime system</title>
233 <itemizedlist>
234 <listitem>
235 <para>
236 TODO FIXME.
237 </para>
238 </listitem>
239 </itemizedlist>
240 </sect3>
241
242 <sect3>
243 <title>Build system</title>
244 <itemizedlist>
245 <listitem>
246 <para>
247 TODO FIXME.
248 </para>
249 </listitem>
250 </itemizedlist>
251 </sect3>
252
253 <sect3>
254 <title>Package system</title>
255 <itemizedlist>
256 <listitem>
257 <para>
258 TODO FIXME.
259 </para>
260 </listitem>
261 </itemizedlist>
262 </sect3>
263 </sect2>
264
265 <sect2>
266 <title>Libraries</title>
267
268 <sect3>
269 <title>array</title>
270 <itemizedlist>
271 <listitem>
272 <para>
273 Version number XXXXX (was 0.5.0.0)
274 </para>
275 </listitem>
276 </itemizedlist>
277 </sect3>
278
279 <sect3>
280 <title>base</title>
281 <itemizedlist>
282 <listitem>
283 <para>
284 Version number XXXXX (was 4.7.0.0)
285 </para>
286 </listitem>
287 <listitem>
288 <para>
289 A new module <literal>GHC.SrcLoc</literal> was added,
290 exporting a new type <literal>SrcLoc</literal>. A
291 <literal>SrcLoc</literal> contains package, module,
292 and file names, as well as start and end positions.
293 </para>
294 </listitem>
295 <listitem>
296 <para>
297 A new type <literal>CallStack</literal> was added for use
298 with the new implicit callstack parameters. A
299 <literal>CallStack</literal> is a
300 <literal>[(String, SrcLoc)]</literal>, sorted by most-recent
301 call.
302 </para>
303 </listitem>
304 <listitem>
305 <para>
306 A new function, <literal>interruptible</literal>, was added
307 to <literal>GHC.IO</literal> allowing an
308 <literal>IO</literal> action to be run such that it can be
309 interrupted by an asynchronous exception, even if exceptions
310 are masked (except if masked with
311 <literal>interruptibleMask</literal>).
312 </para>
313 <para>
314 This was introduced to fix the behavior of
315 <literal>allowInterrupt</literal>, which would previously
316 incorrectly allow exceptions in uninterruptible regions
317 (see Trac #9516).
318 </para>
319 </listitem>
320 </itemizedlist>
321 </sect3>
322
323 <sect3>
324 <title>bin-package-db</title>
325 <itemizedlist>
326 <listitem>
327 <para>
328 This is an internal package, and should not be used.
329 </para>
330 </listitem>
331 </itemizedlist>
332 </sect3>
333
334 <sect3>
335 <title>binary</title>
336 <itemizedlist>
337 <listitem>
338 <para>
339 Version number XXXXX (was 0.7.1.0)
340 </para>
341 </listitem>
342 </itemizedlist>
343 </sect3>
344
345 <sect3>
346 <title>bytestring</title>
347 <itemizedlist>
348 <listitem>
349 <para>
350 Version number XXXXX (was 0.10.4.0)
351 </para>
352 </listitem>
353 </itemizedlist>
354 </sect3>
355
356 <sect3>
357 <title>Cabal</title>
358 <itemizedlist>
359 <listitem>
360 <para>
361 Version number XXXXX (was 1.18.1.3)
362 </para>
363 </listitem>
364 </itemizedlist>
365 </sect3>
366
367 <sect3>
368 <title>containers</title>
369 <itemizedlist>
370 <listitem>
371 <para>
372 Version number XXXXX (was 0.5.4.0)
373 </para>
374 </listitem>
375 </itemizedlist>
376 </sect3>
377
378 <sect3>
379 <title>deepseq</title>
380 <itemizedlist>
381 <listitem>
382 <para>
383 Version number XXXXX (was 1.3.0.2)
384 </para>
385 </listitem>
386 </itemizedlist>
387 </sect3>
388
389 <sect3>
390 <title>directory</title>
391 <itemizedlist>
392 <listitem>
393 <para>
394 Version number XXXXX (was 1.2.0.2)
395 </para>
396 </listitem>
397 </itemizedlist>
398 </sect3>
399
400 <sect3>
401 <title>filepath</title>
402 <itemizedlist>
403 <listitem>
404 <para>
405 Version number XXXXX (was 1.3.0.2)
406 </para>
407 </listitem>
408 </itemizedlist>
409 </sect3>
410
411 <sect3>
412 <title>ghc</title>
413 <itemizedlist>
414 <listitem>
415 <para>
416 TODO FIXME.
417 </para>
418 </listitem>
419 <listitem>
420 <para>
421 The <literal>HsBang</literal> type has been removed in
422 favour of <literal>HsSrcBang</literal> and
423 <literal>HsImplBang</literal>. Data constructors now
424 always carry around their strictness annotations as
425 the user wrote them, whether from an imported module
426 or not.
427 </para>
428 </listitem>
429 </itemizedlist>
430 </sect3>
431
432 <sect3>
433 <title>ghc-prim</title>
434 <itemizedlist>
435 <listitem>
436 <para>
437 Version number XXXXX (was 0.3.1.0)
438 </para>
439 </listitem>
440 </itemizedlist>
441 </sect3>
442
443 <sect3>
444 <title>haskell98</title>
445 <itemizedlist>
446 <listitem>
447 <para>
448 Version number XXXXX (was 2.0.0.3)
449 </para>
450 </listitem>
451 </itemizedlist>
452 </sect3>
453
454 <sect3>
455 <title>haskell2010</title>
456 <itemizedlist>
457 <listitem>
458 <para>
459 Version number XXXXX (was 1.1.1.1)
460 </para>
461 </listitem>
462 </itemizedlist>
463 </sect3>
464
465 <sect3>
466 <title>hoopl</title>
467 <itemizedlist>
468 <listitem>
469 <para>
470 Version number XXXXX (was 3.10.0.0)
471 </para>
472 </listitem>
473 </itemizedlist>
474 </sect3>
475
476 <sect3>
477 <title>hpc</title>
478 <itemizedlist>
479 <listitem>
480 <para>
481 Version number XXXXX (was 0.6.0.1)
482 </para>
483 </listitem>
484 </itemizedlist>
485 </sect3>
486
487 <sect3>
488 <title>integer-gmp</title>
489 <itemizedlist>
490 <listitem>
491 <para>
492 Version number XXXXX (was 0.5.1.0)
493 </para>
494 </listitem>
495 </itemizedlist>
496 </sect3>
497
498 <sect3>
499 <title>old-locale</title>
500 <itemizedlist>
501 <listitem>
502 <para>
503 Version number XXXXX (was 1.0.0.6)
504 </para>
505 </listitem>
506 </itemizedlist>
507 </sect3>
508
509 <sect3>
510 <title>old-time</title>
511 <itemizedlist>
512 <listitem>
513 <para>
514 Version number XXXXX (was 1.1.0.2)
515 </para>
516 </listitem>
517 </itemizedlist>
518 </sect3>
519
520 <sect3>
521 <title>process</title>
522 <itemizedlist>
523 <listitem>
524 <para>
525 Version number XXXXX (was 1.2.0.0)
526 </para>
527 </listitem>
528 </itemizedlist>
529 </sect3>
530
531 <sect3>
532 <title>template-haskell</title>
533 <itemizedlist>
534 <listitem>
535 <para>
536 Version number XXXXX (was 2.9.0.0)
537 </para>
538 </listitem>
539 <listitem>
540 <para>
541 The <literal>Lift</literal> type class for lifting values
542 into Template Haskell splices now has a default signature
543 <literal>lift :: Data a => a -> Q Exp</literal>, which means
544 that you do not have to provide an explicit implementation
545 of <literal>lift</literal> for types which have a <literal>Data</literal>
546 instance. To manually use this default implementation, you
547 can use the <literal>liftData</literal> function which is
548 now exported from <literal>Language.Haskell.TH.Syntax</literal>.
549 </para>
550 </listitem>
551 <listitem>
552 <para>
553 <literal>Info</literal>'s constructors no longer have
554 <literal>Fixity</literal> fields. A <literal>qReifyFixity
555 </literal> function was added to the <literal>Quasi
556 </literal> type class (as well as the <literal>reifyFixity
557 </literal> function, specialized for <literal>Q</literal>)
558 to allow lookup of fixity information for any given
559 <literal>Name</literal>.
560 </para>
561 </listitem>
562 </itemizedlist>
563 </sect3>
564
565 <sect3>
566 <title>time</title>
567 <itemizedlist>
568 <listitem>
569 <para>
570 Version number XXXXX (was 1.4.1)
571 </para>
572 </listitem>
573 </itemizedlist>
574 </sect3>
575
576 <sect3>
577 <title>unix</title>
578 <itemizedlist>
579 <listitem>
580 <para>
581 Version number XXXXX (was 2.7.0.0)
582 </para>
583 </listitem>
584 </itemizedlist>
585 </sect3>
586
587 <sect3>
588 <title>Win32</title>
589 <itemizedlist>
590 <listitem>
591 <para>
592 Version number XXXXX (was 2.3.0.1)
593 </para>
594 </listitem>
595 </itemizedlist>
596 </sect3>
597 </sect2>
598
599 <sect2>
600 <title>Known bugs</title>
601 <itemizedlist>
602 <listitem>
603 <para>
604 TODO FIXME
605 </para>
606 </listitem>
607 </itemizedlist>
608 </sect2>
609 </sect1>