Haskell: Data.Numbers.Primes库在哪里?

7

我尝试导入Data.Numbers.Primes模块

import Data.Numbers.Primes

runhaskell给了我:

5.hs:1:8:
    Could not find module `Data.Numbers.Primes'
    Use -v to see a list of the files searched for.

ghci给出了以下结果:

<no location info>:
    Could not find module `Data.Numbers.Primes'
    It is not a module in the current program, or in any known package.

我尝试通过cabal安装 Data.Numbers.Primes,但是出现了以下错误:

cabal update
...
cabal install Data
cabal: There is no package named 'Data'.
You may need to run 'cabal update' to get the latest list of available
packages.
cabal install Data.Numbers.Primes
cabal: The file does not exist 'Data.Numbers.Primes'.

help?


1
Hayoo 是一个很好的搜索引擎,适用于这类内容。 - Chris Martin
此外,开始使用堆栈来避免依赖地狱问题。 - user1198582
@MichaelLitchard,我是新手,请您详细解释一下吗? - Pigna
没错,随着你的进一步深入,你越来越有可能遇到我们所谓的“依赖地狱”可传递性问题。请查看 Stack 获取解决方案。https://github.com/commercialhaskell/stack/tree/master/doc - user1198582
使用arithmoi包 - Will Ness
1个回答

6
您要查找的包名是 primes
通常情况下,包的名称与其顶级模块名称不一定相同。通常情况下,包会被放在合适的位置上,但这基本上是任意的。当您有疑问时,可以通过Hackage搜索获得帮助。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接