How do Hackage package names map to "cabal install" names?
I use cabal to download Haskell packages.
The following works:
> cabal install JSON Gets Text.JSON
However, this fails:
> cabal install Data.List.Key cabal: "Data.List.Key" is not valid syntax for a package name or package dependency. What is the syntax issue? How to get cabal to get Data.List.Key? In general, for a package named XY, what name does cabal install need to find the package? (I'm confused why cabal install JSON gets Text.JSON and not Foobarbaz.JSON)
The cabal install command uses package names. Package names are different from module names. If you look at the hackage page for a text package , you will see that the package name is โtextโ, but it exports a module called Data.Text (among others). Packages can export any number of modules and there should be no relationship between the package name and the name of the exported modules.
If you know the package that you need, but you do not know the exported modules, see the hack page for this package. To do this, I go to " http://hackage.haskell.org/package/ " in my browser. I went there so many times, it automatically completes very quickly, then I add the package name to the end of this url. If I do not know the exact name of the package, I simply go to this page and look at the list of packages for what I want.
The reverse situation, when you know which module you want, but donโt know which package it provides, is a bit more complicated. In this case, I rely on two great Haskell search engines: Hoogle and Hayoo .