How are Hackage package names mapped to 'cabal install' names?

The cabal install command uses package names. Package names are different from module names. If you look on the hackage page for the text package, you'll see that the package name is "text", but it exports a module called Data.Text (amongst others). Packages can export any number of modules and there does not have to be any relationship between the name of the package and the name of the modules it exports.

If you know a package you want, but you don't know the exported modules, look on the hackage page for that package. To do this, I go to "http://hackage.haskell.org/package/" in my browser. I've gone there so many times, it auto-completes very quickly, then I add the package name to the end of that url. If I don't know the exact package name, then I just go to that page and search the package list for what I want.

The converse situation where you know what module you want but don't know what package provides it is a little more difficult. In this case, I rely on the wonderful Haskell search engine Hoogle.
(Another one Hayoo, has been offline for a while.)

Tags:

Haskell

Cabal