Search code examples
haskellprimes

Haskell: where is Data.Numbers.Primes library?


I tried importing Data.Numbers.Primes

import Data.Numbers.Primes

runhaskell gave me:

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

ghci gave me:

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

I tried to install Data.Numbers.Primes through cabal, but I got:

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?


Solution

  • The package you're looking for is called primes.

    There's no rule that the package will be called the same as its top-level module name. Typically, packages put themselves under whatever makes sense, but that's pretty much arbitrary. When in doubt, Hackage search helps.