我试图用ghc 7.10.2和alex 3.1.4编译一个lex.x,但它给出了下面的错误。我检查了Lex.hs,确实没有'Alex‘的应用实例。
注意:这个错误是在我从包装器'monad‘移动到'monad-bytestring’之后出现的。
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’我看到在ALEX3.1.4中这个问题已经修复了http://hackage.haskell.org/package/alex
Changes in 3.1.4:
Add Applicative/Functor instances for GHC 7.10下面的commit介绍了应用程序实例,但它不存在于我生成的Lex.hs中。我可以手动使用下面的包装器来生成Lex.hs吗?
https://github.com/simonmar/alex/commit/b1472bfbb7b95bcd6c66558197e2603997d9ce0b
发布于 2015-11-18 20:13:32
这是解决此问题的一种方法。基本上,这涉及到从最新的源代码构建alex和修改本地包装器。虽然这对我很有效,但它也可能有一些未知的问题。
mkdir tmp; cd tmp;
git clone https://github.com/simonmar/alex.git
cd alex;
git checkout 3b7e8e4;
cabal build;然后将此目录中生成的'AlexWrapper-monad-bytestring‘复制到本地alex安装中。例如
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’破坏了包装器的编译。
https://stackoverflow.com/questions/33758728
复制相似问题