packages feed

hackage-db 1.10 → 1.11

raw patch · 3 files changed

+9/−17 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Distribution.Hackage.DB.Parsed: parsePackage' :: Monad m => ByteString -> m GenericPackageDescription
+ Distribution.Hackage.DB.Parsed: parsePackage' :: ByteString -> Either String GenericPackageDescription

Files

hackage-db.cabal view
@@ -1,5 +1,5 @@ Name:                   hackage-db-Version:                1.10+Version:                1.11 Copyright:              Peter Simons License:                BSD3 License-File:           LICENSE
src/Distribution/Hackage/DB/Parsed.hs view
@@ -57,19 +57,20 @@     parsePackages :: String -> Map Version ByteString -> Map Version GenericPackageDescription     parsePackages name = Data.Map.mapWithKey (parsePackage name) --- | Parse a single Cabal file. Failure is reported with 'error'.+-- | Convenience wrapper around 'parsePackage'' to parse a single Cabal+-- file. Failure is reported with 'error'.  parsePackage :: String -> Version -> ByteString -> GenericPackageDescription parsePackage name version buf = case parsePackage' buf of                            Right a  -> a                            Left err -> error $ "cannot parse cabal package " ++ show name ++ "-" ++ display version ++ ": " ++ err --- | Parse a single Cabal file. Failure is reported with 'fail'.+-- | Parse a single Cabal file. -parsePackage' :: Monad m => ByteString -> m GenericPackageDescription+parsePackage' :: ByteString -> Either String GenericPackageDescription parsePackage' buf = case parsePackageDescription (decodeUTF8 buf) of-                     ParseOk _ a     -> return a-                     ParseFailed err -> fail (show err)+                     ParseOk _ a     -> Right a+                     ParseFailed err -> Left (show err)   where     decodeUTF8 :: ByteString -> String     decodeUTF8 = toString . fromRep . BSC.unpack
src/Distribution/Hackage/DB/Unparsed.hs view
@@ -20,9 +20,9 @@ import Data.Map import Data.Maybe ( fromMaybe ) import Data.Version+import Distribution.Hackage.DB.Path import Distribution.Text ( simpleParse )-import System.Directory ( getHomeDirectory )-import System.FilePath ( joinPath, splitDirectories )+import System.FilePath ( splitDirectories )  -- | A 'Map' representation of the Hackage database. Every package name -- maps to a non-empty set of version, and for every version there is a@@ -60,12 +60,3 @@      pVersion :: String -> Version     pVersion str = fromMaybe (error $ "Hackage.DB.parseHackage: cannot parse version " ++ show str) (simpleParse str)---- | Determine the default path of the Hackage database, which typically--- resides at @"$HOME\/.cabal\/packages\/hackage.haskell.org\/00-index.tar"@.--- Running the command @"cabal update"@ will keep that file up-to-date.--hackagePath :: IO FilePath-hackagePath = do-  homedir <- getHomeDirectory-  return $ joinPath [homedir, ".cabal", "packages", "hackage.haskell.org", "00-index.tar"]