Search code examples
cabalhaskell-stackhackage

Where do Cabal & Stack fetch Hackage packages from?


I am interested in creating a tool for Hackage involving analysis of the various dependencies between Hackage's packages. I am thinking this would involve downloading and syncing a mirror of all Hackage package sources, in particular the *.cabal files, on which I can run the various analyses I have in mind.

How can I access the same repositories that cabal and stack fetch packages from? Is there an API that cabal and stack use to fetch packages that my program could similarly plug into?


Solution

  • I'm currently working on a library that will give easy (or at least easier) access to this metadata. But the basic rule for getting the metadata on all packages from Hackage is:

    Note that, due to Hackage revisions, there may be multiple cabal files with the same name/version combination (known as the package identifier).