Commit a157b234 authored by Simon Marlow's avatar Simon Marlow
Browse files

remove some unused source files

parent 64ca4381
......@@ -50,16 +50,17 @@ EXPAND = expand
RELEASE_DIR = ../haskell-prime-draft
JFP_DIR = ../jfp-release
PARTS = haskell.tex preface.tex $(PARTS_NO_PREFACE)
PARTS = haskell.tex preface.tex $(PARTS_NO_PREFACE) $(LIB_TEX)
PARTS_NO_PREFACE = iso-chars.tex \
intro.tex lexemes.tex exps.tex \
decls.tex modules.tex basic.tex io-13.tex \
derived.tex \
index-extra.tex index-intro.tex layout.tex fixity.tex \
literate.tex pragmas.tex standard-prelude.tex \
index-extra.tex index-intro.tex fixity.tex \
pragmas.tex standard-prelude.tex \
syntax-lexical.tex syntax-iso.tex ffi.tex \
Prelude.tex PreludeList.tex PreludeText.tex PreludeIO.tex \
Prelude.tex PreludeList.tex PreludeText.tex PreludeIO.tex
LIB_MODULES = Data.Array \
Data.Char \
......@@ -159,15 +160,16 @@ html: $(HT_TEXS) ht/classes.eps ht/haddock.sty
.PHONY: clean veryclean
veryclean: clean
$(RM) *~
$(RM) *~ $(LIB_TEX)
$(RM) ${HT_TEXS} ht/*.html ht/html/* ht/*.htm ht/hask*.png ht/*.log ht/*.tmp \
ht/*.xref ht/classes.eps ht/*.css ht/*.idx ht/*.aux ht/*.dvi \
ht/*.4ct ht/*.4tc
$(RM) *.dvi *.log *.aux *.ilg *.blg *.toc *.bbl *.idx *.tmp *.out \
${PARTS} \
haskell.tex preface.tex $(PARTS_NO_PREFACE) \
haskell.tex haskell.pdf *.o lex.yy.c haskell-report-html/*
# NB. don't clean $(LIB_TEX) here
% $Header: /home/cvs/root/haskell-report/report/layout.verb,v 1.1 2001/03/28 14:13:42 simonpj Exp $
% partain:
% in a separate file, because it is included twice (for now);
% in intro.verb and syntax.verb
% First para added from both sections -- KH
% (was other parts for rest in the first sentence of syntax.verb)
In the syntax given in the rest of the report, {\em layout
lists} are always preceded by the keyword @where@, @let@, @do@,
or @of@, and are
enclosed within curly braces (@{ }@) with the individual declarations
separated by semicolons (@;@). Layout lists usually contain
declarations, but @do@ and @case@ introduce lists of other sorts.
For example, the syntax of a @let@
expression is:
@let {@\ decl_1\ @;@\ decl_2\ @;@\ ...\ @;@\ decl_n\ @} in@\ exp
\Haskell{} permits the omission of the braces and semicolons by
using {\em layout} to convey the same information. This allows both
layout-sensitive and -insensitive styles of coding, which
can be freely mixed within one program. Because layout is
not required, \Haskell{} programs can be straightforwardly
produced by other programs.
% without worrying about deeply nested layout difficulties.
The layout (or ``off-side'') rule\index{off-side rule} takes effect
whenever the open brace is omitted after the keyword @where@, @let@,
@do@, or
@of@. When this happens, the indentation of the next lexeme (whether
or not on a new line) is remembered and the omitted open brace is
inserted (the whitespace preceding the lexeme may include comments).
For each subsequent line, if it contains only whitespace or is
indented more, then the previous item is continued (nothing is
inserted); if it is indented the same amount, then a new item begins
(a semicolon is inserted); and if it is indented less, then the
layout list ends (a close brace is inserted). A close brace is
also inserted whenever the syntactic category containing the
layout list ends; that is, if an illegal lexeme is encountered at
a point where a close brace would be legal, a close brace is inserted.
The layout rule matches only those open braces that it has
inserted; an explicit open brace must be matched by
an explicit close brace. Within these explicit open braces,
{\em no} layout processing is performed for constructs outside the
braces, even if a line is
indented to the left of an earlier implicit open brace.
Given these rules, a single newline may actually terminate several
layout lists. Also, these rules permit:
f x = let a = 1; b = 2
g y = exp2
in exp1
making @a@, @b@ and @g@ all part of the same layout
To facilitate the use of layout at the top level of a module
(an implementation may allow several modules may reside in one file),
the keyword
@module@ and the end-of-file token are assumed to occur in column
0 (whereas normally the first column is 1). Otherwise, all
top-level declarations would have to be indented.
Section~\ref{layout} gives a more precise definition of the layout rules.
% $Header: /home/cvs/root/haskell-report/report/literate.verb,v 1.5 2002/12/02 14:53:30 simonpj Exp $
%**<title>The Haskell 98 Report: Literate Comments</title>
\subsection{Literate comments}
\index{literate comments}
The ``literate comment''
convention, first developed by Richard Bird and Philip Wadler for
Orwell, and inspired in turn by Donald Knuth's ``literate
programming'', is an alternative style for encoding \Haskell{} source
The literate style encourages comments by making them the default. A
line in which ``@>@'' is the first character is treated as part of the
program; all other lines are comment.
The program text is recovered
by taking only those lines beginning with ``@>@'',
and replacing the leading ``@>@'' with a space.
Layout and comments apply
exactly as described in Appendix~\ref{syntax} in the resulting text.
To capture some cases where one omits an ``@>@'' by mistake, it is an
error for a program line to appear adjacent to a non-blank comment line,
where a line is taken as blank if it consists only of whitespace.
By convention, the style of comment is indicated by the file
extension, with ``@.hs@'' indicating a usual Haskell file and
``@.lhs@'' indicating a literate Haskell file. Using this style, a
simple factorial program would be:
This literate program prompts the user for a number
and prints the factorial of that number:
> main :: IO ()
> main = do putStr "Enter a number: "
> l <- readLine
> putStr "n!= "
> print (fact (read l))
This is the factorial function.
> fact :: Integer -> Integer
> fact 0 = 1
> fact n = n * fact (n-1)
An alternative style of literate programming is particularly
suitable for use with the LaTeX text processing system.
In this convention, only those parts of the literate program that are
entirely enclosed between @\begin{code}@$\ldots$@\end{code}@ delimiters are
treated as program text; all other lines are comment. More precisely:
\item Program code begins on the first line following a line that begins @\begin{code}@.
\item Program code ends just before a subsequent line that begins @\end{code}@ (ignoring
string literals, of course).
It is not necessary
to insert additional blank lines before or after these delimiters, though
it may be stylistically desirable. For example,
This is a trivial program that prints the first 20 factorials.
main :: IO ()
main = print [ (n, product [1..n]) | n <- [1..20]]
This style uses the same file extension. It is not advisable to mix
these two styles in the same file.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment