Haskell-找不到模块"Test.QuickCheck" [英] Haskell - could not find module 'Test.QuickCheck'

查看:56
本文介绍了Haskell-找不到模块"Test.QuickCheck"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个错误,提示我尝试运行haskell时该模块不存在.这很奇怪,因为我尝试先安装它并说它是最新的.任何想法如何解决这个问题?

I'm getting an error that says the module doesn't exist when I try to runhaskell. It's odd because I try to install it first and says its up to date. Any idea how to fix this?

推荐答案

您可以尝试创建

You could try creating the package environment in the local directory that holds your project, like this:

c:\Users\...\ex1haskell> cabal install --lib --package-env . QuickCheck

这应在 ex1haskell 中创建一个格式为 .ghc.environment.xxx 的文件,希望该文件应由 runhaskell / ghci / ghc 调用.

This should create a file of the form .ghc.environment.xxx in ex1haskell, which hopefully should be picked up by runhaskell/ghci/ghc invocations.

ghci 会话中,启动时出现以下消息,表明正在拾取环境:

In ghci sessions, a sign that the environment is being picked up is the following message while starting:

从...加载的包环境

Loaded package environment from ...

当未明确给出-package-env 位置时,将使用默认位置.根据文档:

When the --package-env location is not given explicitly, a default location is used. According to the docs:

默认情况下,它正在写入全局环境〜/.ghc/$ ARCH- $ OS- $ GHCVER/环境/默认值.v2-install提供了--package-env标志,用于控制对哪些环境进行修改.

By default, it is writing to the global environment in ~/.ghc/$ARCH-$OS-$GHCVER/environments/default. v2-install provides the --package-env flag to control which of these environments is modified.

但是,似乎 runhaskell 在该默认位置查找环境文件时遇到问题.

But it seems that runhaskell is having problems to find the environment file in that default location.

注意.创建程序包环境时,可以同时指定多个程序包,如下所示:

Note. When creating a package environment, it's possible to specify multiple packages simultaneously, like this:

cabal install --lib --package-env . QuickCheck random aeson transformers

此外,程序包环境只是文本文件,因此可以随意删除和重新创建本地环境.实际的程序包二进制文件位于其他位置,并且可能被 cabal 重用.

Also, package environments are just text files, so local environments can be deleted and recreated at will. The actual package binaries reside elsewhere and can potentially be reused by cabal.

这篇关于Haskell-找不到模块"Test.QuickCheck"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆