[project @ 1997-03-14 05:31:07 by sof]
[ghc-hetmet.git] / ghc / CONTRIB / pphs / docs / Problem_Definition.tex
1 \section{Problem definition}
2
3 The problem is that a system is needed to typeset Haskell programs
4 to be inserted into documents.  This would be useful in, for
5 instance, preparing papers for publication that are to include
6 Haskell programs. 
7
8 Haskell is a fairly new functional programming language and does not
9 as yet have a full range of tools available to use with the language.
10
11 Many people use the \LaTeX\ system for typesetting.  This uses
12 embedded typesetting commands in the input to arrange the typesetting.
13 The result as typeset has variable-width characters with a choice of
14 font styles and sizes available.  The page-size, margins and layout
15 are also controllable by the user.
16
17 Haskell programs are generally written on editors that produce ASCII
18 text.  This has fixed-width characters and one plain font.
19
20 In Haskell, the language avoids using
21 line terminators by having indentation to indicate the contextual meaning of
22 each line. It is thus crucial that this indentation is retained
23 when the text is put into \LaTeX.  However as the \LaTeX\ system uses
24 variable width characters, the indentation
25 level is dependent on the characters under which the text is aligned.
26 The tabs and spaces that went to make
27 up the indentation in the original file have to be replaced with a 
28 suitable amount of space to make the text line up with the position with which it
29 is aligned in the original file. 
30
31 It is also desirable to have
32 formatting improvements such as highlighting keywords and identifiers as well as
33 inserting proper mathematical characters in place of the Haskell-ASCII simulations.
34
35 Currently the only way of doing this is by labouriously inserting formatting
36 commands into the text by hand.  The alternative is to print out the programs
37 verbatim with plain ASCII-style fixed-width font.