module StackOverflow where -- yes, the source of this post compiles as is
Skip down to
I would try to make a standalone preprocessor that runs SO preprocessing code or the standard literary preprocessor, depending on file extension. Then just use :set -pgmL SO-preprocessor
in ghci.conf
.
For the standard literary preprocessor, run the unlit
program, or use Distribution.Simple.PreProcess.Unlit
.
This way, :load
and filename completion just work normally.
GHCI passes 4 arguments to the preprocessor, in order: -h
, the label, the source file name, and the destination file name. The preprocessor should read the source and write to the destination. The label is used to output #line
pragmas. You can ignore it if you don't alter the line count of the source (i.e. replace "comment" lines with --
comments or blank lines).