hackage-db: provide access to the Hackage database via Data.Map

[ bsd3, distribution, library ] [ Propose Tags ]

This module provides simple access to the Hackage database by means of Data.Map. Suppose you wanted to implement a utility that queries the set of available versions for a given package, the following program would do the trick:

import qualified Distribution.Hackage.DB as DB
import Distribution.Text ( display )
import System.Environment ( getArgs )

main :: IO ()
main = do
  pkgs <- getArgs
  db <- DB.readHackage
  let getVersions name = maybe [] DB.keys (DB.lookup name db)
  mapM_ (putStrLn . unwords . map display . getVersions) pkgs

When run, it would produce the following output:

./a.out containers deepseq cabal-install
0.4.0 0.5.0 0.5.1 0.5.2 0.6.0 0.6.2 0.6.4 0.8.0 0.8.2 0.10.0 0.10.2

Note that once the database has been parsed, it can be accessed quickly, but the inital cost of reading 00-index.tar is fairly high.

This package is known to work on Linux and Mac OS X, but not Windows.

Versions 1.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.9.1, 1.10, 1.11, 1.22, 2.0, 2.0.1
Dependencies base (>=3 && <5), bytestring, Cabal, containers, directory, filepath, tar (>=0.4), utf8-string [details]
License BSD-3-Clause
Copyright Peter Simons
Author Peter Simons <simons@cryp.to>
Maintainer Peter Simons <simons@cryp.to>
Category Distribution
Home page http://github.com/peti/hackage-db
Source repo head: git clone git://github.com/peti/hackage-db.git
Uploaded by PeterSimons at Wed Jul 17 17:05:38 UTC 2013
Distributions LTSHaskell:2.0, NixOS:2.0.1, Stackage:2.0.1, openSUSE:2.0
Downloads 9411 total (69 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees