Could not find module ‘Test.QuickCheck’ on Windows

我是研究僧i 提交于 2020-07-18 03:01:47

问题


My ghci version is 8.4.3

I tried

stack install QuickCheck

Something was installed. But when I input import Test.QuickCheck, it tells Could not find module ‘Test.QuickCheck’ again. How can I fix it?


回答1:


Firstly, stack install is not recommended for installing executables or libraries. Instead, there's a couple of things you can do to use the QuickCheck library:

  • If you want to use QuickCheck in a command such as stack ghci or stack ghc, you can add it as a --package option e.g. to run a REPL to play around with QuickCheck you can use stack ghci --package QuickCheck and then write import Test.QuickCheck.
  • If you want to write a small one-file program using QuickCheck, then you can run stack ghc --package QuickCheck -- MyProgram.hs (using the --package option from the last bullet point). Alternately, you can use stack's scripting functionality and include a line such as this at the top of your program: -- stack --resolver lts-12.18 script --package QuickCheck
  • If you want to use QuickCheck in a large project, then add it as a dependency in your my-program.cabal or project.yaml file.

The same guidance applies to any package you may want to use.




回答2:


  1. Download QuickCheck-2.12.6.1.tar.gz

  2. cabal install QuickCheck-2.12.6.1.tar.gz



来源:https://stackoverflow.com/questions/53402263/could-not-find-module-test-quickcheck-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!