簡體   English   中英

Alex wrappers.hs沒有適用實例

[英]Alex wrappers.hs no instance of Applicative

我正在嘗試使用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’

我看到在alex 3.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

這是解決此問題的方法。 基本上,這涉及從最新的源代碼構建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”破壞了包裝器的編譯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM