Re: Literate Programming in Haskell?
Hi, I'm no expert, but I've found a solution that works for me. I use the \begin{code} ... \end{code} delimiters (rather than >). Since these aren't standard Latex, I threw together a style file that called the listings package to handle this. The result is a file that ghc and hugs can compile directly, but which latex can also process. No need for weaving and tangling, while line numbers in error messages are correct. On the other hand, I'm not doing anything very sophisticated - no labelling of blocks or anything like that. I needed to update to the version of tetex in the "testing" Debian release to get this to work - the listing package in the standard distribution doesn't support Haskell (not that I really use that support), so if you get an error message about being unable to load something, that may be the problem. (Warning: I wouldn't recommend moving to Debian testing at the moment; when I last tried the X support had changed significantly and failed to install, so don't upgraed anything apart from tetex). I've included the style file. I don't have a public example yet (hopefully later this week), but I can email you a postscript file directly if you want. Haskell is the first language where I've managed to work happily with literate programming - partly because of the direct integration and partly because the order isn't critical and the code is compact. Cheers, Andrew PS The style file includes lots of stuff unrelated to literate programming - delete everything but the first block, if you like. On Sun, Feb 18, 2001 at 01:53:41AM -0500, 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.
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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (1)
-
andrew@andrewcooke.free-online.co.uk