2

I'm trying to use the haskell-src-exts package to parse Haskell modules. Currently, I'm trying to parse the acme-io package's module, but I keep getting this error no matter what parse mode I try:

*** Exception: fromParseResult: Parse failed at [System/IO/Unsafe/Really/IMeanIt] (1:57): TemplateHaskell is not enabled

The module mentioned makes no references to TemplateHaskell, not in it's LANGUAGE pragma, nor is there a $ anywhere in the source file.

I'm wondering if my parse mode has something to do with it - here it is:

defaultParseMode { parseFilename = toFilePath m
                 , baseLanguage = Haskell2010
                 , extensions = []
                 , ignoreLanguagePragmas = True
                 , ignoreLinePragmas = True
                 , fixities = Nothing
                 }

I've also tried to replace the extensions field with knownExtensions from the parsing suite, without any luck.

Athan Clark
  • 3,886
  • 2
  • 21
  • 39

1 Answers1

1

This is a duplicate question of this answer - using the parseFile function fixed the issue. However, the reader should note that haskell-src-exts uses different parsing than GHC - I ran into another similar issue right after this, because haskell-src-exts can't handle multi-param contexts without -XMultiParamTypeClasses, yet GHC can, borking the parser if you're scraping Hackage. Hint may be a better option, can't say for sure though.

Community
  • 1
  • 1
Athan Clark
  • 3,886
  • 2
  • 21
  • 39