When parsing haskell source files that contain #define
and #if
, parseFileContentsWithMode
gets confused and throws an error about the hash. I tried to include MagicHash
and CPP
in the extension list (extns
, see below) but that didn't work. I can't really change the source files because there are a lot of them.
getModule extns filePath program = fromParseResult $ parseFileContentsWithMode mode program
where
bangPatternsExt = map parseExtension extns
mode = ParseMode filePath Haskell2010 bangPatternsExt False False
The parser failed at:
#if __GLASGOW_HASKELL__ >= 612
instance Lift ModName where
lift = lift . modString
#define
and similar that's causing you problems, you don't wantMagicHash
, you wantCPP
.