literate haskell

Keith Wansbrough
Wed, 20 Mar 2002 17:41:25 +0000

> Why is it necessary to leave a blank line between comments and code?
> I'm using LaTeX  in my lhs files, with the code inside a verbatim 
> environment, and I'd rather start writing my code right after the 
> \begin{verbatim}.


fac    0  = 0
fac (n+1) = (n+1) * fac n

instead of


> fac    0  = 0
> fac (n+1) = (n+1) * fac n


and then define the `code' environment to do verbatim typesetting.  You could start by looking at the LaTeX verbatim.sty package, or moreverb.sty, or simply copy the code for \verbatim and \endverbatim from latex.ltx with appropriate modifications (the latter is probably NOT recommended for the faint-hearted!).

(Haskell knows about both styles of literate comments, and the top one is designed for what you are doing).


--KW 8-)
Keith Wansbrough <>
University of Cambridge Computer Laboratory.