代码之家  ›  专栏  ›  技术社区  ›  Paradox

Haskell QuickCheck-2.11.3包中缺少文件

  •  0
  • Paradox  · 技术社区  · 7 年前

    ghc MyProgramm.hs ,但收到以下错误:

    $ ghc Ex2.hs 
    [1 of 1] Compiling Ex2              ( Ex2.hs, Ex2.o )
    
    Ex2.hs:21:1: error:
        Could not find module ‘Test.QuickCheck’
        There are files missing in the ‘QuickCheck-2.11.3’ package,
        try running 'ghc-pkg check'.
        Use -v to see a list of the files searched for.
       |
    21 | import Test.QuickCheck (
       | ^^^^^^^^^^^^^^^^^^^^^^^^...
    

    我安装了 stack stack update stack install QuickCheck 没有问题,但错误仍然存在。然后,我跑了 cabal install QuickCheck 出现以下错误:

    $ cabal install QuickCheck
    Resolving dependencies...
    Configuring QuickCheck-2.12.4...
    Building QuickCheck-2.12.4...
    Failed to install QuickCheck-2.12.4
    Build log ( /home/username/.cabal/logs/ghc-8.4.3/QuickCheck-2.12.4-3d2YDDqfPBn4BfmTJbpJXK.log ):
    cabal: Entering directory '/tmp/cabal-tmp-9133/QuickCheck-2.12.4'
    Configuring QuickCheck-2.12.4...
    Preprocessing library for QuickCheck-2.12.4..
    Building library for QuickCheck-2.12.4..
    [ 1 of 16] Compiling Test.QuickCheck.Exception ( Test/QuickCheck/Exception.hs, dist/build/Test/QuickCheck/Exception.o )
    [ 2 of 16] Compiling Test.QuickCheck.Random ( Test/QuickCheck/Random.hs, dist/build/Test/QuickCheck/Random.o )
    
    Test/QuickCheck/Random.hs:10:1: error:
        Could not find module ‘System.Random’
        There are files missing in the ‘random-1.1’ package,
        try running 'ghc-pkg check'.
        Use -v to see a list of the files searched for.
       |
    10 | import System.Random
       | ^^^^^^^^^^^^^^^^^^^^
    
    Test/QuickCheck/Random.hs:11:1: error:
        Could not find module ‘System.Random.TF’
        There are files missing in the ‘tf-random-0.5’ package,
        try running 'ghc-pkg check'.
        Use -v to see a list of the files searched for.
       |
    11 | import System.Random.TF
       | ^^^^^^^^^^^^^^^^^^^^^^^
    
    Test/QuickCheck/Random.hs:12:1: error:
        Could not find module ‘System.Random.TF.Gen’
        There are files missing in the ‘tf-random-0.5’ package,
        try running 'ghc-pkg check'.
        Use -v to see a list of the files searched for.
       |
    12 | import System.Random.TF.Gen(splitn)
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    cabal: Leaving directory '/tmp/cabal-tmp-9133/QuickCheck-2.12.4'
    cabal: Error: some packages failed to install:
    QuickCheck-2.12.4-3d2YDDqfPBn4BfmTJbpJXK failed during the building phase. The
    exception was:
    ExitFailure 1
    

    但是,我已经有了arch包 haskell-random , haskell-tf-random haskell-mwc-random 安装。有人知道怎么修吗?

    cabal install random --reinstall .

    1 回复  |  直到 7 年前
        1
  •  0
  •   AJF    7 年前

    即使我有一个 main = do

     $ ghci MyProg.hs
    

    然后要运行快速检查,请找到要运行的测试,然后使用以下工具运行它:

     $ quickCheck my_quick_check