From: Nick North <ndn@uk.co.npl.seg>

(Up to Haskerl index.)
From: Nick North <ndn@uk.co.npl.seg>
Subject: Re: a note on the Haskerl extension to Haskell [long]
Date: Thu, 1 Apr 93 17:42:20 BST
To: haskell@uk.ac.glasgow.dcs


I applaud the intention of the Haskerl group to make the use of Haskell
easier and, in the same spirit, I would like to suggest some further
extensions to make "literate" programming easier.

Most Haskell users (and certainly all Haskell compiler writers) also
use LaTeX, so I suggest that literate programming should be made easier
by integrating some LaTeX features into Haskell to enable automatic
pretty-printing of programs.

My first suggestion is that lists could be delimited by the itemize
environment e.g.

\begin{itemize}
first element,
second element,
long and involved third element,
fourth element
\end{itemize}

The printed version of this list would be of the form:

[first element,
 second element,
 long and involved
   third element,
 fourth element]

so indentation would be automatically taken care of.

Arrays could be similarly defined using the enumerate environment, so:

\begin{enumerate}
first, second, third
\end{enumerate}

would print as:

array (1,3) [1 := first,
             2 := second,
             3 := third]

This requires a little intelligence to work out the upper array bound,
but that is not hard.

The possibilities for mathematical programming are endless. For example:

\sum_{i=0}^{n} x_{i}

would be the sum of the first n+1 elements of the list x, and would be
printed using the sigma notation, which is much easier to read than the
Haskell equivalent.

It goes without saying that Haskerlatex (as I have dubbed it) would
print all variable names in italic, keywords in bold and so forth to
further aid the program reader.

I could go on and on about the advantages of these extensions, but I will
stop now as I would like the Haskerl group to have time to consider them
soon, as I presume it has a strictly limited lifetime.

Nick North
National Physical Laboratory
(Back to Haskerl index.)


Will Partain, partain@dcs.gla.ac.uk; 1998-03-07.