2013-12-19 116 views
1

我試圖使用http://hackage.haskell.org/package/persistent-1.2.3.0,而是通過安裝它後,「陰謀安裝老大難」,GHC沒有找到其暴露的模塊:持久模塊沒有找到

Prelude> import Database.Persist.Types 

<no location info>: 
    Could not find module `Database.Persist.Types' 
    It is not a module in the current program, or in any known package. 

而且GHC-PKG正常工作:

$ ghc-pkg find-module Database.Persist.Types 
/var/lib/ghc/package.conf.d 
/home/apsk/.ghc/x86_64-linux-7.6.3/package.conf.d 
    persistent-1.2.3.0 

我錯過了什麼,或者這只是一個錯誤與cabal/persistent/ghc?我的ghc是7.6.3,順便說一句。

另外,我試過沒有效果:「ghc-pkg recache」; 「ghc-pkg check」;安裝以前的版本;使用和不使用「sudo」和/或「--global」重新安裝。

回答

1
  1. 檢查你沒有使用沙箱,小集團-dev的,hsenv,什麼都可以影響ghc尋找依賴關係確保你使用的是ghc/ghci,而不是任何包裝,並且ghc/ghci不會在你的shell中任何別名。

  2. 嘗試明確指定package-db:

    ghci -package-db /home/apsk/.ghc/x86_64-linux-7.6.3/package.conf.d 
    
  3. 如果您啓動ghci與-v,它會打印(的高速緩存)數據庫,它着眼於,像這樣:

    % ghci -v 
    GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help 
    Glasgow Haskell Compiler, Version 7.6.3, stage 2 booted by GHC version 7.4.2 
    Using binary package database: /opt/ghc763/lib/ghc-7.6.3/package.conf.d/package.cache 
    Using binary package database: /home/feuerbach/.ghc/i386-linux-7.6.3/package.conf.d/package.cache 
    

    確保其具有持久的數據庫列出。

+0

謝謝,麻煩是在多個cabals。 – aemxdp

0

問題只出現在GHCi中,對嗎?自從安裝persistent以來,你重新啓動了GHCi嗎? (也許還有另一種方式來獲得GHCI拿起新安裝的軟件包,但我沒有意識到這一點。

+0

不,這些問題同時影響ghc和ghci(甚至在重新啓動後)。 – aemxdp

1

希望對某人有幫助。使用ghci -v我看了看是否持續在那裏,看到這一點:

package persistent-2.0.8-cec952b1a61645f47dbec3b0b0cbcef4 is unusable due to missing or recursive dependencies: aeson-0.8.0.0-1bd8b5254a1dd30c0fe6acc346ad7de7 attoparsec-0.12.1.2-48393fcdbcf426085b696dc4409d9270 conduit-1.2.0.2-39f9cd0430ed7b7f4306899cbeb1ed83 monad-logger-0.3.7.2-3e6a80e9b3adf31497ff04514bdf2919 resource-pool-0.2.3.0-c02186641e7173f72887d5e65a646ac1 scientific-0.3.3.1-13e0eefbd7215e4503420c3d0a6fdb82 unordered-containers-0.2.5.0-147c3bb8f4a2da7d753455e75af30b92 

所以我看了看周圍的SO(看到這個:Haskell Cabal: Mysterious missing or recursive dependencies),但沒有找到一個偉大的答案。我沒有找到一個很好的here雖然:

$ ghc-pkg list Cabal

顯露我有2個該死cabals!一個在用戶,一個在全球。啊。所以我能夠做到ghc-pkg unregister --user Cabal-1.18.1.3 --force擺脫舊的。然後cabal install cabal自動進入1.20,隱式地進入沒有任何標誌的用戶(備用將是--global)。