-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | access Hackage's package database via Data.Map
--   
--   This module provides simple access to the Hackage database by means of
--   <tt>Data.Map</tt>. 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:
--   
--   <pre>
--   import qualified Distribution.Hackage.DB as DB
--   import Distribution.Text ( display )
--   import System.Environment ( getArgs )
--   
--   main :: IO ()
--   main = do
--     pkgs &lt;- getArgs
--     db &lt;- DB.readHackage
--     let getVersions name = maybe [] DB.keys (DB.lookup name db)
--     mapM_ (putStrLn . unwords . map display . getVersions) pkgs
--   </pre>
--   
--   When run, it would produce the following output:
--   
--   <pre>
--   ./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
--   </pre>
@package hackage-db
@version 1.22


-- | Find the location of the local Hackage database that is maintained by
--   running <tt>cabal update</tt>.
module Distribution.Hackage.DB.Path

-- | Determine the default path of the Hackage database, which typically
--   resides at
--   <tt>"$HOME/.cabal/packages/hackage.haskell.org/00-index.tar"</tt>.
--   Running the command <tt>"cabal update"</tt> will keep that file
--   up-to-date.
hackagePath :: IO FilePath


-- | This module provides simple access to the Hackage database by means of
--   <a>Map</a>.
module Distribution.Hackage.DB.Unparsed

-- | A <a>Map</a> representation of the Hackage database. Every package
--   name maps to a non-empty set of version, and for every version there
--   is a Cabal file stored as a (lazy) <a>ByteString</a>.
type Hackage = Map String (Map Version ByteString)

-- | Read the Hackage database from the location determined by
--   <a>hackagePath</a> and return a <a>Map</a> that provides fast access
--   to its contents.
readHackage :: IO Hackage

-- | Read the Hackage database from the given <a>FilePath</a> and return a
--   <a>Hackage</a> map that provides fast access to its contents.
readHackage' :: FilePath -> IO Hackage

-- | Parse the contents of Hackage's <tt>00-index.tar</tt> into a
--   <a>Hackage</a> map.
parseHackage :: ByteString -> Hackage

-- | Determine the default path of the Hackage database, which typically
--   resides at
--   <tt>"$HOME/.cabal/packages/hackage.haskell.org/00-index.tar"</tt>.
--   Running the command <tt>"cabal update"</tt> will keep that file
--   up-to-date.
hackagePath :: IO FilePath


-- | This module provides simple access to the Hackage database by means of
--   <a>Map</a>.
module Distribution.Hackage.DB.Parsed

-- | A <a>Map</a> representation of the Hackage database. Every package
--   name maps to a non-empty set of version, and for every version there
--   is a parsed Cabal file.
type Hackage = Map String (Map Version GenericPackageDescription)

-- | Read the Hackage database from the location determined by
--   <tt>hackagePath</tt> and return a <a>Map</a> that provides fast access
--   to its contents.
readHackage :: IO Hackage

-- | Read the Hackage database from the given <a>FilePath</a> and return a
--   <a>Hackage</a> map that provides fast access to its contents.
readHackage' :: FilePath -> IO Hackage

-- | Parse the contents of Hackage's <tt>00-index.tar</tt> into a
--   <a>Hackage</a> map.
parseHackage :: ByteString -> Hackage

-- | Convert an <a>Hackage</a> map into a parsed <a>Hackage</a> map.
parseUnparsedHackage :: Hackage -> Hackage

-- | Convenience wrapper around <a>parsePackage'</a> to parse a single
--   Cabal file. Failure is reported with <a>error</a>.
parsePackage :: String -> Version -> ByteString -> GenericPackageDescription

-- | Parse a single Cabal file.
parsePackage' :: ByteString -> Either String GenericPackageDescription


-- | This module provides simple access to the Hackage database by means of
--   <a>Map</a>.
module Distribution.Hackage.DB

-- | A <a>Map</a> representation of the Hackage database. Every package
--   name maps to a non-empty set of version, and for every version there
--   is a parsed Cabal file.
type Hackage = Map String (Map Version GenericPackageDescription)

-- | Read the Hackage database from the location determined by
--   <tt>hackagePath</tt> and return a <a>Map</a> that provides fast access
--   to its contents.
readHackage :: IO Hackage

-- | Read the Hackage database from the given <a>FilePath</a> and return a
--   <a>Hackage</a> map that provides fast access to its contents.
readHackage' :: FilePath -> IO Hackage

-- | Parse the contents of Hackage's <tt>00-index.tar</tt> into a
--   <a>Hackage</a> map.
parseHackage :: ByteString -> Hackage

-- | Determine the default path of the Hackage database, which typically
--   resides at
--   <tt>"$HOME/.cabal/packages/hackage.haskell.org/00-index.tar"</tt>.
--   Running the command <tt>"cabal update"</tt> will keep that file
--   up-to-date.
hackagePath :: IO FilePath
