Could not find `Test.QuickCheck 'module on Ubuntu

I import QuickCheck at the top of my file:

import Test.QuickCheck ... 

Compiling the file with ghc Lab1.hs gives me this error:

 Lab1.hs:1:8: Could not find module `Test.QuickCheck' Use -v to see a list of the files searched for. Failed, modules loaded: none. 

I tried apt-cache search for quickcheck and got a scary package list. I tried installing libghc-test-framework-dev only because I thought the name seemed appropriate, but the error persists.

How to install QuickCheck module?

+6
source share
2 answers

If you are interested in managing Haskell packages outside of your package manager (which may be useful if you are interested in using the latest versions of things), Cabal is a Haskell package manager that allows you to execute

 apt-get install cabal-install cabal update cabal install QuickCheck 

to make QuickCheck available worldwide.

Recently, it is recommended to use the sandbox function for Cabal. This is very similar to Python virtualenv or Ruby bundle if you are more familiar with them. To do this, you must create a “cabbalized” project

 cabal init # in an empty directory 

and then put QuickCheck (and your other library dependencies) in the build-depends: slot of the generated <folder name>.cabal .

After you have done this, you use Cabal for all subsequent package management and compilation commands.

 cabal sandbox init # creates your local package sandbox cabal install --only-dependencies # gets and installs all the build-dependencies cabal repl # starts up GHCi in the local sandbox cabal build # configures and builds the local project cabal sandbox delete # cleans up the sandbox 
+15
source

On Ubuntu 14.04.1:

 sudo apt-get install libghc-quickcheck2-dev 

Before:

 > :m +Test.QuickCheck <no location info>: Could not find module `Test.QuickCheck' It is not a module in the current program, or in any known package. 

After:

 Prelude> :m +Test.QuickCheck Prelude Test.QuickCheck> 
+1
source

Source: https://habr.com/ru/post/956951/


All Articles