#s causing errors when -cpp not given

Ian Lynagh igloo@earth.li
Fri, 1 Feb 2002 14:54:20 +0000

On Mon, Jan 28, 2002 at 05:25:29PM -0000, Simon Marlow wrote:
> You're right, it seems that our 'unlit' program (the filter used to
> convert a literate file into an illiterate one) leaves lines beginning
> with '#' in place.
> We could remove this, but I'm not sure how much code it would break.  We

As far as I can think the only code which should break is code like

    > module Main where

    > (#) = (++)

    > main = putStrLn x
    >   where { x = "foo"
    # "bar" #
    > "baz" }

(which in GHC prints "foobarbaz") which deserves to be broken IMO!

> could also do this conditionally based on a flag to unlit which would be
> turned on if we're planning to CPP the file, but there's another
> problem: sometimes we use {-#OPTIONS -cpp#-} at the top of the file to
> indicate that cpp is to be used, so we don't know whether we're going to
> be cpp'ing until after we've unlitted the file :-(

I would advocate only allowing #s where code is allowed, but I fear that
ship has sailed  :-(
It would also be less simple with > being replaced by a space rather
than removed.