hackage-db: provide access to the Hackage database via Data.Map
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.1.0.0 0.1.0.1 0.2.0.0 0.2.0.1 0.3.0.0 0.4.0.0 1.0.0.0 1.1.0.0 1.1.0.1 1.1.0.2 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 it's probably not going to work on Windows (because no-one tested it, as far as I know).
Modules
- Distribution
- Hackage
- Distribution.Hackage.DB
- Distribution.Hackage.DB.Parsed
- Distribution.Hackage.DB.Unparsed
- Distribution.Hackage.DB
- Hackage
Downloads
- hackage-db-1.9.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 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, 2.1.0, 2.1.1, 2.1.2, 2.1.3 (info) |
---|---|
Dependencies | base (<0), bytestring, Cabal, containers, directory, filepath, tar (>=0.4), utf8-string [details] |
Tested with | ghc >=6.10.4 && <=7.8.3 |
License | BSD-3-Clause |
Copyright | Peter Simons |
Author | Peter Simons <simons@cryp.to> |
Maintainer | Peter Simons <simons@cryp.to> |
Revised | Revision 1 made by HerbertValerioRiedel at 2016-12-11T10:46:05Z |
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 2014-12-07T14:28:01Z |
Distributions | Arch:2.1.3, LTSHaskell:2.1.3, NixOS:2.1.3, Stackage:2.1.3 |
Reverse Dependencies | 8 direct, 2 indirect [details] |
Downloads | 19590 total (3 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs not available [build log] All reported builds failed as of 2016-12-11 [all 6 reports] |