[Haskell-cafe] Literate programming

John Millikin jmillikin at gmail.com
Sat Jun 12 16:33:47 EDT 2010

On Sat, Jun 12, 2010 at 09:21, Martin Drautzburg
<Martin.Drautzburg at web.de> wrote:
> Is literate programming something you guys actually do (I only know that Paul
> Hudak does), or is it basically a nice idea from days gone by?
I use it occasionally for large projects -- its usefulness seems to be
strongly related to how complex / large the codebase is. About 1000
SLOC of code (disregarding constants, comments, etc) is my personal
tipping point.

> In case you do, then how do you do it? Do you use lhs2TeX or what? Do you
> use "bird" style of full-blown LaTeX?
I've experimented with LHS, NoWeb, and NuWeb. LHS is useless -- you
can achieve the exact same effect with standard comments. I can't
figure out why it exists. NuWeb is nice, but immature -- I had trouble
getting it to generate correct output without jumping through hoops.
NoWeb is my current preference for literate programming with Haskell.

I'm writing my own preprocessor, designed for Haskell, though it's
more of a "something to avoid washing the dishes" project than a "this
will ever be released or useful" project.

All commentary is marked up with LaTeX. I suppose you could use
reStructuredText or HTML, but LaTeX has better support for embedding

Something to note is that Cabal really can't handle literate
programming well. Its preprocessor support assumes a 1:1
correspondence for generated files, which is not present in any
non-trivial project. This can be worked around by using Make to run
the preprocessor, and distributing the generated files in Hackage

> Does any of you use leksah? I failed to see any support for literate
> programming in leksah. It candies the backslashes in e.g.
> \documentclass{article} to λdocumentclass{article}.
I've tried using Leksah, but it doesn't display tabs, which obviously
makes formatting rather difficult / impossible. I wonder how anybody
can use it -- do they just use spaces and avoid indenting completely?

GEdit and Vim both work well.

More information about the Haskell-Cafe mailing list