1

I am trying to install the QuickCheck Library using cabal however even though installation was successful the program does not run. I used the command:

cabal install QuickCheck

And installation completed. I import it into my haskell file like this:

import Test.QuickCheck

However I get the error that the QuickCheck module was not found:

error:
    Could not find module `Test.QuickCheck'
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
1 | import Test.QuickCheck

I also tried to install the library manually from the .tar.gz package however I receive this error:

Chops
  • 462
  • 2
  • 7
  • 19
  • What version of GHC and Cabal are you using? – Lambda Fairy Apr 28 '20 at 13:05
  • Did you try using `-v` as the error suggests? Are you using Stack? If so, is `QuickCheck` in the `package.json`? – A. R. Apr 28 '20 at 13:11
  • Also 2.5.1.1 is extremely old and this error is caused by a cabal feature (automatic flags) that this version doesn't support. Use a more recent version of QuickCheck. – Li-yao Xia Apr 28 '20 at 14:35
  • My Cabal version is 3.2.0.0 and my GHC is 8.10.1. I tried downloading a newer version of quickcheck however I am missing the random library. If i list all packages installed with cabal using ```cabal list --installed``` QuickCheck is not there and if I try to install it it says I am up to date. – Chops Apr 28 '20 at 16:23
  • 2
    Related: https://stackoverflow.com/questions/61066435/can-not-load-a-file-that-uses-standard-libraries-in-haskell/61067274#61067274 In short: go to an empty folder and then invoke `cabal install --lib --package-env . QuickCheck`. Invocations of ghci inside the folder will be able to `import Test.QuickCheck`. And `cabal install --lib QuickCheck` should make the library globally available. The documentation for the install subcommand is here: https://cabal.readthedocs.io/en/latest/cabal-commands.html#cabal-v2-install – danidiaz Apr 28 '20 at 19:38

1 Answers1

0

You need to expose QuickCheck module in your Cabal file and build using stack then you can access all functions inside the QuickCheck module.

https://docs.haskellstack.org/en/stable/README/

smuthu06
  • 39
  • 3