After some failed attempts of compiling GreenCard-generated sources
with -O, I boilt down the problem to a bug in GHC's interface lexer.
Here a failing program:
-- Foo.hs ----------------------------------------
module Foo where
bar :: IO Int
bar = _casm_ ``%r = 42;;''
-- Main.hs ---------------------------------------
import Foo
main = bar >>= print
--------------------------------------------------
Compiling these modules without -O works well, but with -O:
panne@liesl> ghc-3.01 -O -recomp -fglasgow-exts -c Foo.hs -o Foo.o
ghc-3.01: module version changed to 1; reason: no old .hi file
panne@liesl> ghc-3.01 -O -recomp -fglasgow-exts -c Main.hs -o Main.o
reader/Lex.lhs:294: Non-exhaustive patterns in case
If the rhs of bar is changed to _casm_ ``%r = 42;'', i.e. only a
single semicolon is used, everything is fine again. With an
intervening space between the semicola (_casm_ ``%r = 42; ;'') it
compiles, too. Another error message can be provoked by
_casm_ ``%r = 42;; ;'' :
panne@liesl> ghc-3.01 -O -recomp -fglasgow-exts -c Foo.hs -o Foo.o
ghc-3.01: module version changed to 1; reason: no old .hi file
panne@liesl> ghc-3.01 -O -recomp -fglasgow-exts -c Main.hs -o Main.o
Main.hs:1: Foo.hi:12 Interface-file parse error; toks= []
Main.hs:1: Could not find valid interface file `Foo'
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne