update to the latest Haddock style
[haskell-report.git] / report / haskell.verb
1 % Formatting for double-sided
2 \documentclass[twoside,10pt]{book}
3
4 \usepackage{times}
5 \usepackage{makeidx}
6 \usepackage{graphicx}
7 \usepackage{url}
8 \usepackage[dvipsnames,usenames]{color}
9 \usepackage[pdftex,bookmarks=true]{hyperref}
10
11 \evensidemargin=0in
12 \oddsidemargin=.5in
13 \sloppy
14
15 %---------------------------------------------------------------------
16 % Joe Fasel said this "twosidefix" is necessary if you really
17 % have a two-sided printer:
18 %       (note: double @@'s for verbatim-ery)
19 \makeatletter
20 \def\titlepage{\@@restonecolfalse\if@@twocolumn\@@restonecoltrue\onecolumn
21  \else \newpage \fi \thispagestyle{empty}\c@@page\m@@ne}
22 \def\endtitlepage{\if@@twoside\newpage\thispagestyle{empty}\hbox{}
23                         \else \c@@page\@@z \fi
24    \if@@restonecol\twocolumn \else \newpage \fi}
25 \makeatother
26 %---------------------------------------------------------------------
27
28 % the major sections have \cleardoublepages between them
29 % if you want those between EVERY section, change the
30 % following defn:
31 \newcommand{\startnewsection}{\clearpage}
32 %
33 % if doing one-sided printing, change this defn to
34 % be just "\clearpage":
35 \newcommand{\startnewstuff}{\cleardoublepage}
36 % keep some pages from looking unbelievably appalling
37 \raggedbottom
38
39 % Fix those ugly floating figures.
40 \renewcommand{\floatpagefraction}{0.1}
41 \renewcommand{\textfraction}{0.1}
42 \renewcommand{\topfraction}{1.0}
43 \renewcommand{\bottomfraction}{1.0}
44
45 % table of contents: show only down to subsections
46 \setcounter{tocdepth}{3}
47 \setcounter{secnumdepth}{3}
48
49 % general formatting
50 \textheight=8.5in
51 \textwidth=6.0in
52 \topmargin=0in
53 \pagestyle{headings}
54
55 \makeindex
56 % an extra thing for makeindex
57 \newcommand{\hseealso}[2]{{\em see also\/} #1}
58
59 % NEWCOMMANDS
60
61 % general
62 \newcommand{\folks}[1]{\begin{quote}\sf#1\end{quote}}
63 \newcommand{\sectionpart}[1]{\vspace{2 ex}\noindent{\bf #1}}
64 \newcommand{\bq}{\begin{quote}}
65 \newcommand{\eq}{\end{quote}}
66 \newcommand{\bt}{\begin{tabular}}
67 \newcommand{\et}{\end{tabular}}
68 \newcommand{\bto}{\begin{tabular}}
69 \newcommand{\eto}{\end{tabular}}
70 \newcommand{\bi}{\begin{itemize}}
71 \newcommand{\ei}{\end{itemize}}
72 \newcommand{\struthack}[1]{\rule{0pt}{#1}}
73 \newcommand{\inputHS}[1]{{\small \input{#1}}}
74 % Use smaller font 
75
76 \newcommand{\ToDo}[1]{}
77 %\newcommand{\ToDo}[1]{({\bf $\spadesuit$ ToDo:} {\em #1})}
78
79 \newcommand{\WeSay}[1]{}
80 %\newcommand{\WeSay}[1]{({\bf $\clubsuit$ YaleSays:} {\em #1})}
81
82 \newcommand{\anchor}[2]{#2}
83
84 % indexing
85 \newcommand{\indextt}[1]{\index{#1@@{\tt #1}}}
86 \newcommand{\indexsyn}[1]{\index{#1@@{\it #1}}}
87 \newcommand{\indexmodule}[1]{\index{#1@@{\tt #1} (module)}}
88 \newcommand{\indextycon}[1]{\index{#1@@{\tt #1} (datatype)}}
89 \newcommand{\indexsynonym}[1]{\index{#1@@{\tt #1} (type synonym)}}
90 \newcommand{\indexclass}[1]{\index{#1@@{\tt #1} (class)}}
91 \newcommand{\indexdi}[1]{\index{#1@@{\tt #1} (class)!derived instance}}
92 \newcommand{\indexnote}[1]{#1n}
93 \newcommand{\emptystr}{[\,]}
94 \newcommand{\ignorehtml}[1]{#1}
95
96 \makeatletter
97 \def\theindex{\@@restonecoltrue\if@@twocolumn\@@restonecolfalse\fi
98 \columnseprule \z@@
99 \columnsep 35pt\twocolumn[\section*{Index}
100         \addcontentsline{toc}{section}{Index}
101         \input{index-intro}\vskip 20pt]
102  \@@mkboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@@
103  \parskip\z@@ plus .3pt\relax\let\item\@@idxitem
104 }
105 \makeatother
106
107 % outlined figures
108 \newcommand{\ecaption}[1]{\vspace{-1 ex}\caption{#1}\vspace{1 ex}}
109 \newsavebox{\fmbox}
110
111 \newenvironment{outlineenv}
112   {\begin{lrbox}{\fmbox}%
113    \begin{minipage}{415pt}%
114    \vspace{1 ex}}
115   {\end{minipage}%
116    \vspace{1 ex}%
117     \end{lrbox}%
118     \begin{center}%
119     \fbox{\usebox{\fmbox}}%
120      \end{center}}
121
122 \newcommand{\outline}[1]{%
123 \begin{lrbox}{\fmbox}%
124 \begin{minipage}{415pt}%
125 \vspace{1 ex}
126 #1  
127 \end{minipage}%
128 \vspace{1 ex}%
129 \end{lrbox}%
130 \begin{center}%
131 \fbox{\usebox{\fmbox}}%
132 \end{center}
133 }
134
135 \newcommand{\outlinec}{\outline}
136
137 % we used to have a complicated arrangement with a tabular environment
138 % to indent the code blocks a little, but it ran into difficulties
139 % when I started using the verbatim environment for code, also it
140 % looked bad in the HTML output.  The simple way works best: just use
141 % the quote environment. --SDM 4/2010
142 \newcommand{\bprog}{\vspace{-1ex}\begin{quote}}
143 \newcommand{\eprog}{\end{quote}\vspace{-1ex}}
144 \newcommand{\bprogB}{}
145 \newcommand{\eprogB}{}
146 \newcommand{\eprogNoSkip}{\eprog}
147
148 % general from ffi.tex
149 %
150 \newcommand{\clearemptydoublepage}{%
151   \newpage{\pagestyle{empty}\cleardoublepage}}
152
153 %special characters
154 \newcommand{\bkq}{\mbox{\tt \char'022}} % (syntax) backquote char
155 \newcommand{\bkqB}{\bkq\hspace{-.2em}} % (syntax) backquote char (Before)
156 \newcommand{\bkqA}{\hspace{-.2em}\bkq}% (syntax) backquote char (After)
157 %\newcommand{\fwq}{\mbox{\it \char'023}} % (syntax) (forward) quote char
158 % math formatting
159 \newcommand{\ba}{\begin{array}}
160 \newcommand{\ea}{\end{array}}
161 \newcommand{\mc}{\multicolumn}
162 \newcommand{\pile}[1]{\ba[t]{@@{}l@@{}} #1 \ea}
163 \newcommand{\eqn}[1]{\ba[t]{@@{}lcl@@{}} #1 \ea}
164 \newcommand{\equate}[1]{\[\eqn{#1}\]}
165 \newcommand{\la}{\leftarrow}
166 \newcommand{\ra}{\rightarrow}
167 \newcommand{\sq}[1]{[\,#1\,]}
168 \newcommand{\ab}[1]{\langle#1\rangle}
169 \newcommand{\ablarge}[1]{\langle \pile{#1\,\rangle}}
170 \newcommand{\lb}{[\![}
171 \newcommand{\rb}{]\!]}
172 \newcommand{\db}[1]{\lb#1\rb}
173 \newcommand{\ti}[1]{\mbox{{\it #1}}}
174 \newcommand{\tr}[1]{\mbox{{\rm #1}}}
175 \newcommand{\tb}[1]{\mbox{{\bf #1}}}
176 \newcommand{\x}{\times}
177 \newcommand{\lam}{\lambda}
178 \newcommand{\kr}{\kappa_{\rho}}
179 \newcommand{\syneq}{\rightarrow}
180 % denotational semantics
181 \newcommand{\denote}[3]{\[\ba{c} {\cal #1} : #2 \\[1 ex] #3 \ea\]}
182 \newcommand{\den}[2]{{\cal #1}\db{#2}\,}
183
184 \newcommand{\A}{\den{A}}
185 \newcommand{\B}{\den{B}}
186 \newcommand{\D}{\den{D}}
187 \newcommand{\E}{\den{E}}
188 \newcommand{\F}{\den{F}}
189 \newcommand{\G}{\den{G}}
190 \newcommand{\I}{\den{I}}
191 %%% \renewcommand{\L}{\den{L}}
192 \newcommand{\LE}{\den{L_E}}
193 \newcommand{\LH}{\den{L_H}}
194 \newcommand{\M}{\den{M}}
195 %%% \renewcommand{\O}{\den{O}}
196 \renewcommand{\P}{\den{P}}
197 \newcommand{\Pbot}{\den{P_{\bot}}}
198 \newcommand{\Q}{\den{Q}}
199 \newcommand{\R}{\den{R}}
200 \renewcommand{\S}{\den{S}}
201 \newcommand{\V}{\den{V}}
202 \newcommand{\W}{\den{W}}
203 \newcommand{\T}[2]{\den{T}{#1}\,\db{#2}}
204 % meta language
205 \newcommand{\PP}{\den{P'}}
206 \newcommand{\PS}{\den{P_S}}
207 \newcommand{\otherwise}{\quad\tr{otherwise}}
208 \newcommand{\case}[2]{\pile{
209  \tr{case}\ (#1)\ \tr{of} \\
210  \ba{@@{\quad}l@@{\ \ra\ }l@@{}} #2 \ea}}
211 \newcommand{\where}[2]{#1 \quad\tr{where}\quad #2}
212 \newcommand{\wherelarge}[2]{\pile{#1 \\ \tr{where} \\ \eqn{#2}}}
213 \newcommand{\cond}[3]{#1 \ra #2,\ #3}
214 \newcommand{\condlarge}[1]{\ba[t]{@@{}l@@{\ \ra\ }l@@{}} #1 \ea}
215 \newcommand{\range}[2]{{}_{#1}^{#2}\,}
216 % semantic operators
217 \newcommand{\concat}{\frown}
218 \newcommand{\seq}[1]{\ti{List}\ #1}
219 \newcommand{\opt}[1]{\widetilde{#1}}
220 \newcommand{\ov}{\opt{v}}
221 \newcommand{\fail}{\ti{none}}
222 \newcommand{\nonfail}{\ti{proper}}
223 \newcommand{\sym}{\bigtriangledown}
224 \newcommand{\pri}{\mathbin{\vec{\sym}}}
225 \newcommand{\mrg}{\mathbin{\dot{\sym}}}
226 \newcommand{\Sym}{\mathbin{\nabla}}
227 \newcommand{\Pri}{\mathbin{\vec{\Sym}}}
228 \newcommand{\Mrg}{\mathbin{\dot{\Sym}}}
229 \newcommand{\optSym}{\mathbin{\opt{\Sym}}}
230 \newcommand{\optodot}{\mathbin{\opt{\odot}}}
231 \newcommand{\proj}{\mid}
232 \newcommand{\restrict}{\setminus}
233 \newcommand{\sel}[4]{\ti{sel}_{#3#2}\ #4}
234 \newcommand{\bindnone}{\ti{bindnone}}
235 \newcommand{\bindvar}[2]{\ti{bindvar}\ \db{#1}\ #2}
236 \newcommand{\bindcon}[2]{\ti{bindcon}\ \db{#1}\ #2}
237 \newcommand{\bindconlarge}[4]{
238  #4\ \bindcon{#1}{\ablarge{ #2, \\ #3}}}
239 \newcommand{\bindmod}[2]{\ti{bindmod}\ \db{#1}\ #2}
240
241 \newcommand{\lookupval}[2]{\ti{lookupval}\ #1\ \db{#2}} %%% NEW
242 \newcommand{\lookupcon}[1]{\ti{lookupcon}\ \db{#1}} %%% NEW
243 \newcommand{\lookupdecon}[2]{\ti{lookupdecon}\ #1\ \db{#2}} %%% NEW
244
245 % used in static.verb
246 \newcommand{\TT}{\den{T_T}}
247 \newcommand{\TA}{\den{T_A}}
248 \newcommand{\TB}{\den{T_B}}
249 \newcommand{\TD}{\den{T_D}}
250 \newcommand{\TDA}{\den{T_{D_A}}}
251 \newcommand{\TDB}{\den{T_{D_B}}}
252 \newcommand{\TDP}{\den{T_{P_D}}}
253 \newcommand{\TE}{\den{T_E}}
254 \newcommand{\TLE}{\den{T_{L_E}}}
255 \newcommand{\TLH}{\den{T_{L_H}}}
256 %%% \newcommand{\TG}{\den{T_G}}
257 \newcommand{\TQ}{\den{T_Q}}
258 %%% \newcommand{\TR}{\den{T_R}}
259 \newcommand{\TF}{\den{T_F}}
260 \newcommand{\TFA}{\den{T_F'}}
261 \newcommand{\TP}{\den{T_P}}
262 \newcommand{\TPP}{\den{T_P'}}
263 \newcommand{\TPS}{\den{T_{PS}}}
264 \newcommand{\MGU}{\ti{MGU}}
265 \newcommand{\TI}{\den{T_I}}
266 \newcommand{\TL}{\den{T_L}}
267 \newcommand{\TM}{\den{T_M}}
268 %%% \newcommand{\TO}{\den{T_O}}
269 \newcommand{\TS}{\den{T_S}}
270 \newcommand{\TV}{\den{T_V}}
271 \newcommand{\tenvm}{\ddot{\nabla}}
272 \renewcommand{\tb}[1]{\triangleright#1\triangleleft}
273 \newcommand{\unbindvar}[2]{\ti{unbindvar}\ \db{#1}\ #2}
274 \newcommand{\unbindcon}[2]{\ti{unbindcon}\ \db{#1}\ #2}
275
276 % Haskell syntax macros: math mode assumed
277 \newcommand{\system}[2]{#1@;;@\cdots@;;@#2}
278 \newcommand{\module}[4]{module\ #1@:@\ #2\ #3\ #4}
279 \newcommand{\exposing}[1]{@expose@\ #1}
280 \newcommand{\hiding}[1]{@hide@\ #1}
281 \newcommand{\importnone}{\;}
282 \newcommand{\importcomb}[2]{#1\ @;;@\ #2}
283 \newcommand{\import}[2]{@import@\ #1\ #2}
284 \newcommand{\rename}[2]{#1\ @=@\ #2}
285 \newcommand{\declcomb}[2]{#1\ @;;@\ #2}
286
287 \newcommand{\type}[2]{@type@\ #1\ @=@\;#2}
288 \newcommand{\data}[2]{@data@\ #1\ @=@\;#2}
289 \newcommand{\tuple}[2]{@tuple@\ #1\ @=@\;#2} %%% NEW!
290 \newcommand{\view}[3]{@view@\ #1\ @=@\;#2\ @where@\ @{@\ #3\ @}@}
291 \newcommand{\class}[2]{@class@\ #1\ @where@\ @{@\ #2\ @}@}
292 \newcommand{\instance}[2]{@instance@\ #1\ @where@\ @{@\ #2\ @}@}
293 \newcommand{\signature}[2]{#1\ @::@\ #2}
294 \newcommand{\binding}[2]{#1\ @=@\ #2}
295 \newcommand{\lamexpr}[2]{@\@ #1 @->@ #2}
296
297 % While lambda defs. change...  if change, take care of preceding line MMG
298 \newcommand{\lamb}{@\ @}
299 \newcommand{\whereexpr}[2]{#1\ @where@\ @{@\ #2\ @}@}
300 \newcommand{\compexpr}[2]{@[@#1\ @|@\ #2@]@}
301 \newcommand{\genclause}[2]{#1\ @<-@\ #2}
302 \newcommand{\qualcomb}[2]{#1\ @,@\ #2}
303 \newcommand{\genguard}[1]{\ #1\ }
304 \newcommand{\caseexpr}[2]{@case@\ #1\ @of@\ @{@\ #2\ @}@}
305 \newcommand{\simplecaseexpr}[5]{@case@\ #1\ @of@\ @{@\ #2\ @->@\ #3;\ #4\ @->@\ #5\ @}@} 
306 \newcommand{\iteexpr}[3]{@if@\ #1\ @then@\ #2\ @else@\ #3}
307 \newcommand{\itexpr}[2]{@if@\ #1\ @then@\ #2}
308 \newcommand{\gpat}[2]{#1\ @|@\ #2}
309 \newcommand{\aspat}[2]{#1 @ @@ @ #2}
310 \newcommand{\fclause}[2]{#1\ @=@\ #2}
311 \newcommand{\fsym}[2]{#1\ @;@\ #2}
312 \newcommand{\fpri}[2]{#1\ @;@\ @else@\ @;@\ #2}
313 \newcommand{\aclause}[2]{#1\ @->@\ #2}
314 \newcommand{\saclause}[4]{#1\ @->@\ #2;\ #3\ @->@\ #4}
315 \newcommand{\asym}[2]{#1\ @;@\ #2}
316 \newcommand{\apri}[2]{#1\ @;@\ @else@\ @;@\ #2}
317 \newcommand{\dotted}[3]{#1\ #2\ \ldots\ #3}
318 \newcommand{\functype}[2]{#1\ @->@\ #2}
319 \newcommand{\predtype}[2]{#1\ @=>@ #2}
320 \newcommand{\xp}{\dotted{x}{p_1}{p_n}}
321 \newcommand{\xpg}{\dotted{x}{p_1}{p_n\ @{@\ g\ @}@}}
322 \newcommand{\es}{e_1\ \ldots\ e_n}
323 \newcommand{\ps}{p_1\ \ldots\ p_n}
324 \newcommand{\vs}{v_1\ \ldots\ v_n} %%% NEW
325 \newcommand{\xs}{x_1\ \ldots\ x_n} %%% NEW
326 \newcommand{\cT}{\dotted{c}{T_1}{T_n}}
327 \newcommand{\cTm}{\dotted{c_i}{T_{i1}}{T_{in_i}}\, @|@\range{i=1}{m}}
328 % syntax meta-language
329 \newcommand{\arity}[1]{\tr{arity}\ #1}
330 \newcommand{\infix}[1]{\tr{infix}\ #1}
331 \newcommand{\prefix}[1]{\tr{prefix}\ #1}
332 %
333 \newcommand{\tl}[1]{{\sc #1}}
334 \newcommand{\Haskell}{Haskell}
335
336 \newcommand{\subsubsubsection}{\subsubsection*}
337 \newcommand{\subsubsubsubsection}{\subsubsubsection*}
338
339 % Haskell-prime markup: this annotates the new/changed parts of the report.
340 \definecolor{prime}{named}{DarkOrchid}
341 \newcommand{\hprime}[1]{\color{prime}#1\normalcolor}
342 \newenvironment{haskellprime}{\color{prime}}{\normalcolor}
343
344 %\sloppy
345
346 % a few hyphenation patterns, anyone?
347 \hyphenation{da-ta-type da-ta-types}
348 \hyphenation{Has-kell}
349
350 % Macros for Haddock output
351 \usepackage{haddock}
352
353 \begin{document}
354
355 \input{iso-chars}
356
357 % Set the float fractions to sensible values
358 \setcounter{topnumber}{2}
359 \setcounter{bottomnumber}{0}
360 \setcounter{totalnumber}{2}
361 \setcounter{dbltopnumber}{2}
362 \renewcommand{\textfraction}{0.1}
363 \renewcommand{\floatpagefraction}{0.9}
364 \renewcommand{\dblfloatpagefraction}{0.9}
365
366 \setcounter{page}{0}
367
368 % ------------------------- Title page -----------------------------------
369
370 \begin{titlepage}
371
372 \setcounter{page}{0}
373
374 \outline{
375 \vspace{.3in}
376 \begin{center}
377 {\LARGE\bf Haskell 2010} \\[.1in]
378 {\LARGE\bf Language Report} \\[.3in]
379 \end{center}
380 \vspace{.3in}
381 }
382 \vspace{.15in}
383 \begin{center} \large
384 Simon Marlow\\
385 (editor)
386 \end{center}
387 \vspace{.15in}
388
389 \vspace{3in}
390
391 \begin{center} \emph{Copyright notice.} \end{center}
392
393 The authors and publisher intend this Report to belong to the entire Haskell
394 community, and grant permission to copy and distribute it for any
395 purpose, provided that it is reproduced in its
396 entirety, including this Notice. Modified versions of this Report may
397 also be copied and distributed for any 
398 purpose,
399 provided that the modified version is clearly presented as such, and
400 that it does not claim to be a definition of the language Haskell 2010.
401 \end{titlepage}
402
403 % ------------------------- Preface -----------------------------------
404
405 \pagenumbering{roman}
406
407 \clearpage
408 \clearpage
409 \tableofcontents
410 \startnewstuff
411
412 \parskip=10pt plus2pt minus2pt
413 \setlength{\parindent}{0cm}
414
415 \input{preface}
416
417 % ------------------------- Part I: language report -----------------------------------
418
419 \pagestyle{headings}
420 \startnewstuff
421 \pagenumbering{arabic}
422
423 \part{The Haskell 2010 Language}
424
425 \input{intro}\startnewsection
426 \input{lexemes}\startnewsection
427 \input{exps}\startnewsection
428 \input{decls}\startnewsection
429 \input{modules}\startnewsection
430 \input{basic}\startnewsection
431 \input{io-13}\startnewsection
432 \input{ffi}\startnewsection
433
434 % \appendix
435 \input{standard-prelude}\startnewsection
436 \input{syntax-iso}\startnewsection
437 \input{fixity}\startnewsection
438 \input{derived}\startnewsection
439 \input{pragmas}
440 %%
441
442 % ------------------------- Part II: libraries report -----------------------------------
443
444 \part{The Haskell 2010 Libraries}
445 \label{libraries}
446
447 \input{libs/Control-Monad}
448 \input{libs/Data-Array}
449 \input{libs/Data-Bits}
450 \input{libs/Data-Char}
451 \input{libs/Data-Complex}
452 \input{libs/Data-Int}
453 \input{libs/Data-Ix}
454 \input{libs/Data-List}
455 \input{libs/Data-Maybe}
456 \input{libs/Data-Ratio}
457 \input{libs/Data-Word}
458 \input{libs/System-Environment}
459 \input{libs/System-Exit}
460 \input{libs/Foreign}
461 \input{libs/Foreign-C}
462 \input{libs/Foreign-C-Error}
463 \input{libs/Foreign-C-String}
464 \input{libs/Foreign-C-Types}
465 \input{libs/Foreign-ForeignPtr}
466 \input{libs/Foreign-Marshal}
467 \input{libs/Foreign-Marshal-Alloc}
468 \input{libs/Foreign-Marshal-Array}
469 \input{libs/Foreign-Marshal-Error} 
470 \input{libs/Foreign-Marshal-Utils}
471 \input{libs/Foreign-Ptr}
472 \input{libs/Foreign-StablePtr}
473 \input{libs/Foreign-Storable}
474 \input{libs/System-IO}
475 \input{libs/System-IO-Error}
476
477 % ------------------------- Index and references -----------------------------------
478
479 \startnewstuff
480 % insert the extra indexing things LAST
481 \input{index-extra}
482
483 % Add a contents line for the References -- may be off by one page
484 \addcontentsline{toc}{section}{References}
485 \bibliographystyle{plain}
486 \bibliography{haskell}
487 %
488 \startnewstuff
489 \printindex
490
491 \end{document}
492
493 % Local Variables: 
494 % mode: latex
495 % End: