
On Thu, Jan 17, 2013 at 08:00:43PM +0100, Martin Drautzburg wrote:
Hello all,
I am using literate haskell quite a lot (otherwise I don't understand my own code). This works fine for the code as such. But when I give an example usage, I run code snippets in ghci and copy&paste into the main document/program, which turns them into "text" (and not code).
When I make changes to the program these examples tend to no longer reflect the actual program.
Is there a way to automatically run examples and include them in the .lhs file, preferably with the haskell prompt and everything?
This sounds nice but I don't know of any such thing. It shouldn't be too bad to parse a literate Haskell file with haskell-src-exts, process some of the literate comments, and then write it back out. Unfortunately I do not know of a nice way to capture ghci output. You can find an extremely hacky solution in BlogLiterately, much of which was copied from the lhs2TeX source: http://hub.darcs.net/byorgey/BlogLiterately/browse/src/Text/BlogLiterately/G... -Brent