haskell-src-exts解析CPP失败模块的解决方法或解决方法
问题描述:
我想使用haskell-src-exts
做一堆haskell源文件的解析,但在我测试的第一个文件中遇到了麻烦。这里是第一位:haskell-src-exts解析CPP失败模块的解决方法或解决方法
{-# LANGUAGE CPP, MultiParamTypeClasses, ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
----------------------------------------------------------------------
-- |
-- Module : FRP.Reactive.Fun
-- Copyright : (c) Conal Elliott 2007
-- License : GNU AGPLv3 (see COPYING)
--
-- Maintainer : [email protected]
-- Stability : experimental
--
-- Functions, with constant functions optimized, with instances for many
-- standard classes.
----------------------------------------------------------------------
module FRP.Reactive.Fun (Fun, fun, apply, batch) where
import Prelude hiding
(zip, zipWith
#if __GLASGOW_HASKELL__ >= 609
, (.), id
#endif
)
#if __GLASGOW_HASKELL__ >= 609
import Control.Category
#endif
而且我使用的测试代码:
*Search> f <- parseFile "/tmp/file.hs"
*Search> f
ParseFailed (SrcLoc {srcFilename = "/tmp/file.hs", srcLine = 19, srcColumn = 1}) "Parse error: ;"
问题似乎是CPP条件节,但现在看来,CPP是supported extenstion。我正在使用haskell-src-exts-1.11.1
与ghc 7.0.4
我只是想做一些快速和肮脏的分析,所以我不介意在解析之前剥离这些部分,如果我必须,但更好的解决方案将受到欢迎。
啊,我想我可以看看我链接到的文档。我确实看到了这个错误报告,但误解了这个错误在1.9.x版本中得到了解决。你能告诉我为什么haskell-src-exts依赖于'cpphs'(我不是很好奇,无法查看代码)吗? – jberryman 2012-02-10 22:58:03
@jberryman它使用cpphs的'Language.Preprocessor.Unlit'模块读取Literate Haskell源文件。 – ivanm 2012-02-11 00:06:04