Haskell-src-exts 抛出模板Haskell 错误
Haskell-src-exts throws TemplateHaskell error
我正在尝试使用 haskell-src-exts package to parse Haskell modules. Currently, I'm trying to parse the acme-io 包的模块,但无论我尝试哪种解析模式,我都会收到此错误:
*** Exception: fromParseResult: Parse failed at [System/IO/Unsafe/Really/IMeanIt] (1:57): TemplateHaskell is not enabled
提到的模块没有引用 TemplateHaskell,不在它的 LANGUAGE
编译指示中,源文件中也没有 $
。
我想知道我的解析模式是否与它有关 - 这里是:
defaultParseMode { parseFilename = toFilePath m
, baseLanguage = Haskell2010
, extensions = []
, ignoreLanguagePragmas = True
, ignoreLinePragmas = True
, fixities = Nothing
}
我也曾尝试用 the parsing suite 中的 knownExtensions
替换 extensions
字段,但没有成功。
这是一个重复的问题 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 可能是更好的选择,但不能肯定。
我正在尝试使用 haskell-src-exts package to parse Haskell modules. Currently, I'm trying to parse the acme-io 包的模块,但无论我尝试哪种解析模式,我都会收到此错误:
*** Exception: fromParseResult: Parse failed at [System/IO/Unsafe/Really/IMeanIt] (1:57): TemplateHaskell is not enabled
提到的模块没有引用 TemplateHaskell,不在它的 LANGUAGE
编译指示中,源文件中也没有 $
。
我想知道我的解析模式是否与它有关 - 这里是:
defaultParseMode { parseFilename = toFilePath m
, baseLanguage = Haskell2010
, extensions = []
, ignoreLanguagePragmas = True
, ignoreLinePragmas = True
, fixities = Nothing
}
我也曾尝试用 the parsing suite 中的 knownExtensions
替换 extensions
字段,但没有成功。
这是一个重复的问题 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 可能是更好的选择,但不能肯定。