[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / CONTRIB / pphs / docs / Faults.tex
1 \chapter{Things that don't work} \label{faults}
2
3 The {\tt pphs} program has some deficiencies that cause it to not always produce the
4 correct code.  These are detailed in this chapter.
5
6 \section{Internal alignment}
7
8 The program can deal only with simple internal alignment.  It cannot deal with a
9 situation where there is more than one column where internal alignment is occurring
10 on the same line.  This can occur when two sections of internal
11 alignment overlap by having lines in common or where one section is wholly within another.
12 When this happens, {\tt pphs} will only
13 line up one occurrence of internal alignment on each line.
14
15 Related is left alignment under a section of internal alignment.  Take this earlier example.
16 \begin{quote}
17 \input{Haskell_leftindent1}
18 \end{quote}
19 This is how this code is typeset by {\tt pphs}:
20 \begin{quote}
21 \input{LaTeX_leftindent1}
22 \end{quote}
23 Notice how the {\bf where} on the third line doesn't line up under the {\it gcd\/}$'$ on
24 the second.  The reason for this
25 is the \LaTeX\ {\tt tabular} section does not respect any spaces that occur at the end
26 of the right hand edge of the left hand column such as those after
27 {\tt gcd x y} and instead moves the central column left
28 so it is only one space away from the longest piece of text in the left hand column,
29 in this case {\iden gcd\/}\xspa1 {\iden x\/}\xspa1 {\iden y\/}.
30 The left indentation of the lines under the internal alignment section does not take this
31 movement into account and so if a line is indented beyond the end of the text in the first
32 column of the last line of the internal alignment section then it may be incorrectly
33 positioned and therefore will not align with what it was aligned with in the original
34 program.  Should a piece of text in the left hand column be longer once typeset than what was
35 previously the longest, due to the variable-width characters used by \LaTeX ,
36 then the second and third columns will get moved to the right, and so, similarly,
37 any code indented under the other columns will be wrongly positioned.
38
39 Where a section of internal alignment coincides with the bottom of the user's page,
40 it can run off the bottom of the page.  This is because the {\tt tabular} environment
41 used for internal alignment sections does not allow pagebreaks.  Therefore the pagebreak
42 will come after the section has been completed.
43
44 \section{Mathematical symbols}
45
46 Mathematical symbols are always written in math font.  This means that where, say,
47 comments are re-defined to be in typewriter font, as in the following
48 example, any mathematical symbols in the comments
49 will appear in math font, rather than typewriter font.
50 \begin{quote}
51 \def\com{\tt}
52 \input{LaTeX_comment}
53 \end{quote}
54
55 \section{Left indentation}
56
57 Where a line is indented beyond the end of its predecessor and aligns under another
58 line, but when typeset, the predecessor becomes longer than the indentation level
59 due to the variable-width characters,  the line's indentation will appear to be under the
60 predecessor line.
61
62 \section{Floating point numbers}
63
64 Currently {\tt pphs} will recognise strings such as {\tt 3.} or {\tt 5.6e} as
65 valid floating point numbers.  This needs rectifying so only valid floating
66 point numbers are recognised.