Literate Programming in Haskell?

In the Haskell community is there a generally accepted best way to approach Literate Programming? The language has support for literate comments, but it seems that many common LP tools don't respect it. For example, in order to convert some .lhs code into LaTeX via the noweb LP tools, I had to write a preprocessor to convert the ">" code blocks into something that noweb would respect. (The preprocessor actually does a bit more and, in conjunection with noweb, gives pretty good results for little effort. For an example, see: http://www.ellium.com/~thor/hangman/cheating-hangman.lhs http://www.ellium.com/~thor/hangman/cheating-hangman.pdf ) Yet somehow, I don't think that my homebrew approach is optimal. Can anybody recommend a particularly elegant LP setup for Haskell programming? Or if you have an approach that works well for you, would you mind sharing it? Cheers, Tom

On Sun, 18 Feb 2001, Tom Moertel wrote:
In the Haskell community is there a generally accepted best way to approach Literate Programming? The language has support for literate comments, but it seems that many common LP tools don't respect it.
I'm also very interested in this, but ideally I would want the output to be in some proportional font, with symbols like =>, ->, <- replaced with arrows, etc. Also, it would be very nice to have the code automatically column aligned (using heuristics). I saw something that looks like this in Mark P. Jones's paper `Typing Haskell in Haskell', but don't know how he did it. Cheers, Andreas. ------------------------------------------------------------------------ Andreas Gruenbacher gruenbacher@geoinfo.tuwien.ac.at Research Assistant Phone +43(1)58801-12723 Institute for Geoinformation Fax +43(1)58801-12799 Technical University of Vienna Cell phone +43(664)4064789

In the Haskell community is there a generally accepted best way to approach Literate Programming? The language has support for literate comments, but it seems that many common LP tools don't respect it.
I'm also very interested in this, but ideally I would want the output to be in some proportional font, with symbols like =>, ->, <- replaced with arrows, etc. Also, it would be very nice to have the code automatically column aligned (using heuristics).
So am I. Is anybody willing to cooperate on the desing of such tool? The solution based on the package `listings' is really nice (especially because of its simplicity). However, if different proportional fonts are used for different lexical categories and the indentation is preserved (as it should be in Haskell), the package does not produce the best results.
I saw something that looks like this in Mark P. Jones's paper `Typing Haskell in Haskell', but don't know how he did it.
Perhaps he used ``Haskell Style for LaTeX2e'' (written by Manuel Chakravarty); just a guess. Or did it manually. Bo"stjan Slivnik

On Mon, 19 Feb 2001, Bostjan Slivnik wrote:
I'm also very interested in this, but ideally I would want the output to be in some proportional font, with symbols like =>, ->, <- replaced with arrows, etc. Also, it would be very nice to have the code automatically column aligned (using heuristics).
So am I. Is anybody willing to cooperate on the desing of such tool?
A tool I am using is Ralf Hinze's lhs2tex http://www.informatik.uni-bonn.de/~ralf/Literate.tar.gz http://www.informatik.uni-bonn.de/~ralf/Guide.ps.gz It transforms .lhs files (with some formatting commands in LaTeX-style comments) to LaTeX. Development based on this idea is something I would be willing to participate in as I already have a fair amount of Haskell code/articles (read: my PhD thesis;-) in this format. Maybe Ralf can say something about his views on further development of lhs2tex (copyright etc.) by other people (us?). /Patrik Jansson PS. I have made some small improvements to lhs2tex locally and I seem to remember that one or two of those were actually needed to get it to run with my ghc version.

You also might take a look at Maarten Fokkinga's mira.sty
http://www.cse.ogi.edu/~mbs/src/textools/ and Mark Shileds' abbrev.sty which
was derived from that http://www.cse.ogi.edu/~mbs/src/textools/.
Erik
----- Original Message -----
From: "Patrik Jansson"
On Mon, 19 Feb 2001, Bostjan Slivnik wrote:
I'm also very interested in this, but ideally I would want the output
to
be in some proportional font, with symbols like =>, ->, <- replaced with arrows, etc. Also, it would be very nice to have the code automatically column aligned (using heuristics).
So am I. Is anybody willing to cooperate on the desing of such tool?
A tool I am using is Ralf Hinze's lhs2tex
http://www.informatik.uni-bonn.de/~ralf/Literate.tar.gz
http://www.informatik.uni-bonn.de/~ralf/Guide.ps.gz
It transforms .lhs files (with some formatting commands in LaTeX-style comments) to LaTeX. Development based on this idea is something I would be willing to participate in as I already have a fair amount of Haskell code/articles (read: my PhD thesis;-) in this format.
Maybe Ralf can say something about his views on further development of lhs2tex (copyright etc.) by other people (us?).
/Patrik Jansson
PS. I have made some small improvements to lhs2tex locally and I seem to remember that one or two of those were actually needed to get it to run with my ghc version.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Patrik Jansson wrote:
A tool I am using is Ralf Hinze's
http://www.informatik.uni-bonn.de/~ralf/Literate.tar.gz
http://www.informatik.uni-bonn.de/~ralf/Guide.ps.gz
It transforms .lhs files (with some formatting commands in LaTeX-style comments) to LaTeX. Development based on this idea is something I would be willing to participate in as I already have a fair amount of Haskell code/articles (read: my PhD thesis;-) in this format.
Maybe Ralf can say something about his views on further development of lhs2tex (copyright etc.) by other people (us?).
[Sorry for the delay.] In principle, everyone can use and/or modify the program to adjust it to her needs. However, since I use lhs2text almost daily, I am willing to maintain the program. So if you have suggestions, proposals etc please let me know. Cheers, Ralf

On Thu, Mar 01, 2001 at 02:39:32PM +0100, Ralf Hinze wrote:
In principle, everyone can use and/or modify the program to adjust it to her needs. However, since I use lhs2text almost daily, I am willing to maintain the program. So if you have suggestions, proposals etc please let me know.
From my cursory glance, it looked quite interesting, but I was disturbed by the changes required in the TeX source that didn't refer to Haskell at all. Is there any way to improve that situation?
Best, Dylan Thurston
participants (7)
-
Andreas Gruenbacher
-
Bostjan Slivnik
-
Dylan Thurston
-
Erik Meijer
-
Patrik Jansson
-
Ralf Hinze
-
Tom Moertel