| Hugs supports the latexish "\begin{code} .. \end{code}" in .lhs files.
|
| by adding this code to "input.c" you could also support HTML
| ...
It's a neat idea to encourage publication of Haskell code on the web.
But, personally, I think that including \begin{code} ... \end{code}
support in Hugs was a mistake, and I would rather remove that than add
support for HTML (or for any other markup language you might choose).
In my opinion, these things are better dealt with by standalone filters,
hs2latex, hs2html, hs2rtf, etc ... Here are the reasons why:
o Haskell already has three different commenting conventions (//, {-
and literate-style bird tracks). That's three times as many as many
other languages, and already makes the interaction between different
commenting styles a little confusing at times.
o Why stop at LaTeX and html? Why support those two formats and not
the formats that other people use to write their Haskell code? Maybe
these are the most popular tools now, but who knows what we'll be
using in a few years from now?
o The existing commenting conventions in Haskell are easy enough for even
simple preprocessors to recognize and transform in appropriate ways.
o The use of \begin{code} or <code> implies a fairly specific handling
of code fragments in LaTeX or HTML; what if I want to use different
macros or tags to typeset my Haskell using these tools? The builtin
mechanisms are of no use to me in that case!
o And what if I want to run Haskell code on my machine, publish it on
the web, and also generate a neatly typeset copy for printing, all
from the same source to ensure consistency? If I go for the
\begin{code} style, for example, then I'll have to rely on fairly
generic latex2html converters that might not do a particularly good
job when handed the specific task of formatting Haskell programs.
But if I write my code in standard Haskell, then I can run my
code directly and use custom preprocessors that are carefully
designed to generate output in the other formats that I need.
For all these reasons, I would strongly discourage anyone from using
\begin{code} or <code> conventions in Haskell source, or from adding
support for these features to their implementations. Instead, I would
much prefer to see people preprocessors, just for personal use, or for
distribution and use by the whole Haskell community.
All the best,
Mark