2015-11-17 27 views
1

我想用ghc 7.10.2和alex 3.1.4编译lex.x,但是它给出了下面的错误。 我检查了Lex.hs,确实没有'Alex'的应用实例。Alex wrappers.hs没有应用的实例

注:此错误开始来后,我从包装“单子”搬到“单子-字节字符串”

templates/wrappers.hs:287:10: 
    No instance for (Applicative Alex) 
     arising from the superclasses of an instance declaration 
    In the instance declaration for ‘Monad Alex’ 

我看到,在亚历克斯3.1.4本固定http://hackage.haskell.org/package/alex

Changes in 3.1.4: 

    Add Applicative/Functor instances for GHC 7.10 

下面的提交介绍了应用实例,但它不存在于我生成的Lex.h中。我可以手动使用下面的包装来生成Lex.hs吗?

https://github.com/simonmar/alex/commit/b1472bfbb7b95bcd6c66558197e2603997d9ce0b

+2

这看起来像用cabal/stack构建alex的问题。如果我从最新的github源码构建alex,那么它的包装看起来很好。在此处打开此问题以跟踪https://github.com/simonmar/alex/issues/73。 – dfordivam

回答

1

这是此问题的方法。基本上这涉及到从最新的源代码构建alex并修改本地包装器。虽然这对我有用,但它也可能有一些未知的问题。

mkdir tmp; cd tmp; 
git clone https://github.com/simonmar/alex.git 
cd alex; 
git checkout 3b7e8e4; 
cabal build; 

然后复制“AlexWrapper-单子-字节字符串”这个目录添加到一个在本地安装的亚历克斯在产生。 例如

cp AlexWrapper-monad-bytestring ~/.stack/snapshots/x86_64-linux/lts-3.14/7.10.2/share/x86_64-linux-ghc-7.10.2/alex-3.1.4/AlexWrapper-monad-bytestring 

从背后“3b7e8e4”建设的原因是,在提交“447bbb8”打破了包装的编译由于引入额外的功能。