我尝试导入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'.
帮助?
答案 0 :(得分:6)
您正在寻找的包名为primes
。
没有规则将包调用为顶层模块名称。通常情况下,软件包将自己置于任何有意义的东西之下,但这几乎是随意的。如有疑问,Hackage search有帮助。