Haskell Alex wrappers.hs没有应用程序的实例
我试图用ghc 7.10.2和alex 3.1.4编译一个lex.x,但它给出了以下错误。 我检查了Lex.hs,实际上那里没有“Alex”的应用实例 注意:这个错误是在我从包装器'monad'移动到'monad bytestring'后开始出现的Haskell Alex wrappers.hs没有应用程序的实例,haskell,alex,Haskell,Alex,我试图用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 decla
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’
我在alex 3.1.4中看到了这一点
下面的commit介绍了应用程序实例,但它不在我生成的Lex.hs中。我可以手动使用下面的包装器来生成Lex.hs吗
这是解决此问题的一种方法。基本上,这包括从最新的源代码构建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”生成的原因是,提交“447BB8”由于引入了一个额外的功能而破坏了包装器的编译。这看起来像是使用cabal/stack生成alex的问题。如果我从最新的github源代码构建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