2015-11-17 26 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」打破了包裝的編譯由於引入額外的功能。