[英]Can't find module Test.HUnit
我試圖在Haskell中進行一些單元測試,這基本上就是我在代碼中所做的:
module Test where
import Test.HUnit
test = TestList [TestLabel "running all the tests!"
$ TestList [
. . . . .
]]
run = runTestTT tests
當我嘗試使用gchi編譯它時,我收到此消息:
Could not find module ‘Test.HUnit’
Use -v to see a list of the files searched for.
Failed, modules loaded: none
我如何讓HUnit工作?
我使用GHCi版本7.8.3
謝謝
我嘗試通過cabal安裝HUnit作為建議的答案,但后來我得到了錯誤:
Could not find module ‘Test.HUnit’ Perhaps you haven't installed the "dyn" libraries for
package ‘HUnit-1.2.5.2’?
Use -v to see a list of the files searched for.
然后我使用了命令:
cabal install base
我收到了這條消息:
Resolving dependencies...
All the requested packages are already installed:
base-4.7.0.1
Use --reinstall if you want to reinstall anyway.
所以我使用了命令:
cabal install base -reinstall
重新安裝以防萬一,我收到了消息:
Resolving dependencies...
cabal: Could not resolve dependencies:
rejecting: base-4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0,
4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0 (only
already installed instances can be used)
rejecting: base-3.0.3.2 (conflict: base => base>=4.0 && <4.3)
rejecting: base-3.0.3.1 (conflict: base => base>=4.0 && <4.2)
我該怎么辦?
結果我錯誤地安裝了兩個版本的ghc(7.6.3和7.8.3),所以我將它們與cabal一起移除並重新安裝了所有東西。 現在它有效!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.