packages feed

cabal2nix 2.14.4 → 2.15.0

raw patch · 13 files changed

+94/−111 lines, 13 filesdep ~Cabaldep ~distribution-nixpkgsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: Cabal, distribution-nixpkgs

API changes (from Hackage documentation)

- Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.Aeson.Types.FromJSON.FromJSON Distribution.Types.VersionRange.VersionRange
- Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.String.IsString Distribution.Types.VersionRange.VersionRange
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.Aeson.Types.FromJSON.FromJSON Distribution.Types.VersionRange.Internal.VersionRange
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Data.String.IsString Distribution.Types.VersionRange.Internal.VersionRange
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Text.PrettyPrint.HughesPJClass.Pretty Data.Version.Version
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Text.PrettyPrint.HughesPJClass.Pretty Distribution.Compiler.CompilerId
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Text.PrettyPrint.HughesPJClass.Pretty Distribution.System.Platform
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Text.PrettyPrint.HughesPJClass.Pretty Distribution.Types.PackageId.PackageIdentifier
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Text.PrettyPrint.HughesPJClass.Pretty Distribution.Types.PackageName.PackageName
+ Distribution.Nixpkgs.Haskell.OrphanInstances: instance Text.PrettyPrint.HughesPJClass.Pretty Distribution.Types.Version.Version
- Distribution.Nixpkgs.Haskell.FromCabal.Configuration: assertConsistency :: Monad m => Configuration -> m Configuration
+ Distribution.Nixpkgs.Haskell.FromCabal.Configuration: assertConsistency :: MonadFail m => Configuration -> m Configuration

Files

cabal2nix.cabal view
@@ -1,5 +1,5 @@ name:               cabal2nix-version:            2.14.4+version:            2.15.0 synopsis:           Convert Cabal files into Nix build instructions. description:   Convert Cabal files into Nix build instructions. Users of Nix can install the latest@@ -8,73 +8,26 @@   > nix-env -i cabal2nix license:            BSD3 license-file:       LICENSE-author:             Peter Simons,-                    Andres Loeh,-                    Benno Fünfstück,-                    Mateusz Kowalczyk,-                    Michael Alan Dorman,-                    Tom Smalley,-                    Mathijs Kwik,-                    Shea Levy,-                    Dmitry Malikov,-                    Eric Seidel,-                    Jacob Mitchell,-                    Graham Christensen,-                    Hamish Mackenzie,-                    Nikolay Amiantov,-                    Aycan iRiCAN,-                    Bryan Gardiner,-                    Joe Hermaszewski,-                    John Wiegley,-                    Philipp Hausmann,-                    Spencer Janssen,-                    Tom Hunger,-                    William Casarin,-                    koral,-                    ksaric,-                    Adam Vogt,-                    Alexey Shmalko,-                    Corey O'Connor,-                    Cray Elliott,-                    David Johnson,-                    Dmitry Bushev,-                    Domen Kožar,-                    Felix Kunzmann,-                    Gabriel Ebner,-                    Gergely Risko,-                    Joachim Fasting,-                    John Albietz,-                    John Chee,-                    Jussi Maki,-                    Lisanna Dettwyler,-                    Mark Laws,-                    Mark Wotton,-                    Matthew Pickering,-                    Matthew Stewart,-                    Matvey Aksenov,-                    Nicholas Clarke,-                    Nicolas Rolland,-                    Oliver Charles,-                    Pascal Wittmann,-                    Patrick John Wheeler,-                    Phil de Joux,-                    Piotr Bogdan,-                    Profpatsch,-                    Raymond Gauthier,-                    Renzo Carbonara,-                    Rodney Lorrimar,-                    Sibi,-                    Sukant Hajra,-                    Tanner Doshier,-                    Vaibhav Sagar,-                    Viktar Basharymau,-                    danbst,-                    karsten gebbert,-                    laMudri,-                    Александр Цамутали+author:             Peter Simons, Andres Loeh, Benno Fünfstück, Mateusz Kowalczyk,+                    Michael Alan Dorman, Tom Smalley, Mathijs Kwik, Shea Levy, Dmitry+                    Malikov, Eric Seidel, Jacob Mitchell, Graham Christensen,+                    Hamish Mackenzie, Nikolay Amiantov, Aycan iRiCAN, Bryan+                    Gardiner, Joe Hermaszewski, John Wiegley, Philipp Hausmann,+                    Spencer Janssen, Tom Hunger, William Casarin, koral,+                    ksaric, Adam Vogt, Alexey Shmalko, Corey O'Connor, Cray+                    Elliott, David Johnson, Dmitry Bushev, Domen Kožar, Felix+                    Kunzmann, Gabriel Ebner, Gergely Risko, Joachim Fasting,+                    John Albietz, John Chee, Jussi Maki, Lisanna Dettwyler,+                    Mark Laws, Mark Wotton, Matthew Pickering, Matthew Stewart,+                    Matvey Aksenov, Nicholas Clarke, Nicolas Rolland, Oliver+                    Charles, Pascal Wittmann, Patrick John Wheeler, Phil de+                    Joux, Piotr Bogdan, Profpatsch, Raymond Gauthier, Renzo+                    Carbonara, Rodney Lorrimar, Sibi, Sukant Hajra, Tanner+                    Doshier, Vaibhav Sagar, Viktar Basharymau, danbst, karsten+                    gebbert, laMudri, Александр Цамутали maintainer:         Peter Simons <simons@cryp.to> stability:          stable-tested-with:        GHC == 8.6.4+tested-with:        GHC == 8.6.5, GHC == 8.8.1 category:           Distribution, Nix homepage:           https://github.com/nixos/cabal2nix#readme bug-reports:        https://github.com/nixos/cabal2nix/issues@@ -108,14 +61,14 @@   other-modules:      Paths_cabal2nix   hs-source-dirs:     src   build-depends:      base                 > 4.11-                    , Cabal                > 2.4+                    , Cabal                > 3                     , aeson                > 1                     , ansi-wl-pprint                     , bytestring                     , containers           >= 0.5.9                     , deepseq              >= 1.4                     , directory-                    , distribution-nixpkgs >= 1.2+                    , distribution-nixpkgs >= 1.3.1                     , filepath                     , hackage-db           >= 2.0.1                     , hopenssl             >= 2
hackage2nix/Main.hs view
@@ -23,6 +23,7 @@ import Distribution.Nixpkgs.Haskell.FromCabal import Distribution.Nixpkgs.Haskell.FromCabal.Configuration as Config import Distribution.Nixpkgs.Haskell.FromCabal.Flags+import Distribution.Nixpkgs.Haskell.OrphanInstances ( ) import Distribution.Nixpkgs.Meta import Distribution.Nixpkgs.PackageMap import Distribution.Package@@ -62,7 +63,7 @@       pinfo :: ParserInfo CLI       pinfo = info               (   helper-              <*> infoOption ("hackage2nix " ++ display Main.version) (long "version" <> help "Show version number")+              <*> infoOption ("hackage2nix " ++ prettyShow Main.version) (long "version" <> help "Show version number")               <*> cliOptions               )               (  fullDesc@@ -92,7 +93,7 @@       latestVersionSet = Map.map Set.findMax (Map.filter (not . Set.null) (Map.mapWithKey (enforcePreferredVersions preferredVersions) hackage))        defaultPackageOverridesSet :: PackageSet-      defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _) <- defaultPackageOverrides config ]+      defaultPackageOverridesSet = Map.fromList [ (name, resolveConstraint c hackage) | c@(Dependency name _ _) <- defaultPackageOverrides config ]        generatedDefaultPackageSet :: PackageSet       generatedDefaultPackageSet = (defaultPackageOverridesSet `Map.union` latestVersionSet) `Map.difference` corePackageSet@@ -105,7 +106,7 @@        extraPackageSet :: PackageMultiSet       extraPackageSet = Map.unionsWith Set.union-                          [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _) <- extraPackages config ]+                          [ Map.singleton name (Set.singleton (resolveConstraint c hackage)) | c@(Dependency name _ _) <- extraPackages config ]        db :: PackageMultiSet       db = Map.unionsWith Set.union [ Map.map Set.singleton generatedDefaultPackageSet@@ -115,7 +116,7 @@                                     ]        haskellResolver :: Dependency -> Bool-      haskellResolver (Dependency name vrange)+      haskellResolver (Dependency name vrange _)         | Just v <- Map.lookup name corePackageSet                = v `withinRange` vrange         | Just v <- Map.lookup name generatedDefaultPackageSet    = v `withinRange` vrange         | otherwise                                               = False@@ -137,7 +138,7 @@       let isInDefaultPackageSet, isHydraEnabled, isBroken :: Bool           isInDefaultPackageSet = (== Just v) (Map.lookup name generatedDefaultPackageSet)           isHydraEnabled = isInDefaultPackageSet && not (isBroken || name `Set.member` dontDistributePackages config)-          isBroken = any (withinRange v) [ vr | Dependency pn vr <- brokenPackages config, pn == name ]+          isBroken = any (withinRange v) [ vr | Dependency pn vr _ <- brokenPackages config, pn == name ]            droppedPlatforms :: Set Platform           droppedPlatforms = Map.findWithDefault mempty name (unsupportedPlatforms config)@@ -164,7 +165,7 @@                   & metaSection.homepage .~ ""            overrides :: Doc-          overrides = fcat $ punctuate space [ disp b <> semi | b <- Set.toList (view (dependencies . each) drv `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]+          overrides = fcat $ punctuate space [ pPrint b <> semi | b <- Set.toList (view (dependencies . each) drv `Set.union` view extraFunctionArgs drv), not (isFromHackage b) ]       return $ render $ nest 2 $         hang (doubleQuotes (text  attr) <+> equals <+> text "callPackage") 2 (parens (pPrint drv)) <+> (braces overrides <> semi) @@ -204,7 +205,7 @@                       ]  resolveConstraint' :: Constraint -> Hackage -> Maybe Version-resolveConstraint' (Dependency name vrange) hackage+resolveConstraint' (Dependency name vrange _) hackage   | Just vset' <- Map.lookup name hackage   , vset <- Set.filter (`withinRange` vrange) vset'   , not (Set.null vset)         = Just (Set.findMax vset)
src/Cabal2nix.hs view
@@ -18,7 +18,6 @@ import qualified Data.Set as Set import Data.String import Data.Time-import qualified Distribution.Compat.ReadP as P import Distribution.Compiler import Distribution.Nixpkgs.Fetch import Distribution.Nixpkgs.Haskell@@ -26,13 +25,14 @@ import Distribution.Nixpkgs.Haskell.FromCabal.Flags import qualified Distribution.Nixpkgs.Haskell.FromCabal.PostProcess as PP (pkg) import qualified Distribution.Nixpkgs.Haskell.Hackage as DB+import Distribution.Nixpkgs.Haskell.OrphanInstances ( ) import Distribution.Nixpkgs.Haskell.PackageSourceSpec import Distribution.Nixpkgs.Meta-import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment ) import Distribution.Package ( packageId )+import Distribution.PackageDescription ( mkFlagName, mkFlagAssignment, FlagAssignment )+import Distribution.Parsec as P import Distribution.Simple.Utils ( lowercase ) import Distribution.System-import Distribution.Text import Language.Nix import Options.Applicative import Paths_cabal2nix ( version )@@ -94,8 +94,8 @@           <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")           <*> switch (long "shell" <> help "generate output suitable for nix-shell")           <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")-          <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)-          <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)+          <*> option parseCabal (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith prettyShow)+          <*> option (maybeReader parsePlatform) (long "system" <> help "host system (in either short Nix format or full LLVM style) to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith prettyShow)           <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")           <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))           <*> pure (\i -> Just (binding # (i, path # [ident # "pkgs", i])))@@ -110,10 +110,8 @@         Nothing      -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg         Just utcTime -> Right utcTime -readP :: P.ReadP a a -> ReadM a-readP p = eitherReader $ \s -> case [ r' | (r',"") <- P.readP_to_S p s ] of-                                    (r:_) -> Right r-                                    _     -> Left ("invalid value " ++ show s)+parseCabal :: Parsec a => ReadM a+parseCabal = eitherReader eitherParsec  -- | Replicate the normalization performed by GHC_CONVERT_CPU in GHC's aclocal.m4 -- since the output of that is what Cabal parses.@@ -164,7 +162,7 @@ pinfo :: ParserInfo Options pinfo = info         (   helper-        <*> infoOption ("cabal2nix " ++ display version) (long "version" <> help "Show version number")+        <*> infoOption ("cabal2nix " ++ prettyShow version) (long "version" <> help "Show version number")         <*> options         )         (  fullDesc
src/Distribution/Nixpkgs/Fetch.hs view
@@ -161,7 +161,9 @@       ExitFailure _ -> return Nothing       ExitSuccess   -> do         buf <- BS.hGetContents stdoutH-        let (l:ls) = reverse (BS.lines buf)+        let (l,ls) = case reverse (BS.lines buf) of+                       []     -> error "This can't happen, but GHC doesn't know that."+                       (x:xs) -> (x,xs)             buf'   = BS.unlines (reverse ls)         case length ls of           0 -> return Nothing
src/Distribution/Nixpkgs/Haskell/Constraint.hs view
@@ -9,7 +9,7 @@ type Constraint = Dependency  satisfiesConstraint :: PackageIdentifier -> Constraint -> Bool-satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr) = (pn /= cn) || (v `withinRange` vr)+satisfiesConstraint (PackageIdentifier pn v) (Dependency cn vr _) = (pn /= cn) || (v `withinRange` vr)  satisfiesConstraints :: PackageIdentifier -> [Constraint] -> Bool satisfiesConstraints p = all (satisfiesConstraint p)
src/Distribution/Nixpkgs/Haskell/Derivation.hs view
@@ -112,8 +112,8 @@   pPrint drv@MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat     [ text "mkDerivation" <+> lbrace     , nest 2 $ vcat-      [ attr "pname"   $ doubleQuotes $ disp (packageName _pkgid)-      , attr "version" $ doubleQuotes $ disp (packageVersion _pkgid)+      [ attr "pname"   $ doubleQuotes $ pPrint (packageName _pkgid)+      , attr "version" $ doubleQuotes $ pPrint (packageVersion _pkgid)       , pPrint _src       , onlyIf (_subpath /= ".") $ attr "postUnpack" postUnpack       , onlyIf (_revision > 0) $ attr "revision" $ doubleQuotes $ int _revision
src/Distribution/Nixpkgs/Haskell/FromCabal.hs view
@@ -58,14 +58,14 @@                           }      jailbroken :: HaskellResolver -> HaskellResolver-    jailbroken resolver (Dependency pkg _) = resolver (Dependency pkg anyVersion)+    jailbroken resolver (Dependency pkg _ _) = resolver (Dependency pkg anyVersion mempty)      withInternalLibs :: HaskellResolver -> HaskellResolver     withInternalLibs resolver d = depPkgName d `elem` internalNames || resolver d      internalNames :: [PackageName]     internalNames =    [ unqualComponentNameToPackageName n | (n,_) <- condSubLibraries genDesc ]-                    ++ [ unqualComponentNameToPackageName n | Just n <- libName <$> subLibraries (packageDescription genDesc) ]+                    ++ [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries (packageDescription genDesc) ]    in case finalize (jailbroken (withInternalLibs haskellResolver)) of     Left m -> case finalize (const True) of@@ -119,7 +119,7 @@     nixLicense =  either fromSPDXLicense fromCabalLicense licenseRaw      resolveInHackage :: Identifier -> Binding-    resolveInHackage i | (i^.ident) `elem` [ unPackageName n | (Dependency n _) <- missingDeps ] = bindNull i+    resolveInHackage i | (i^.ident) `elem` [ unPackageName n | (Dependency n _ _) <- missingDeps ] = bindNull i                        | otherwise = binding # (i, path # ["self",i])   -- TODO: "self" shouldn't be hardcoded.      -- TODO: This is all very confusing. Haskell packages refer to the Nixpkgs@@ -144,11 +144,11 @@       | otherwise                        = bindNull i      resolveInHackageThenNixpkgs :: Identifier -> Binding-    resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion) = resolveInHackage i+    resolveInHackageThenNixpkgs i | haskellResolver (Dependency (mkPackageName (i^.ident)) anyVersion mempty) = resolveInHackage i                                   | otherwise = resolveInNixpkgs i      internalLibNames :: [PackageName]-    internalLibNames = fmap unqualComponentNameToPackageName . catMaybes $ libName <$> subLibraries+    internalLibNames = [ unqualComponentNameToPackageName n | LSubLibName n <- libName <$> subLibraries ]      doHaddockPhase :: Bool     doHaddockPhase | not (null internalLibNames) = False@@ -158,7 +158,7 @@     convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo     convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty     convertBuildInfo Cabal.BuildInfo {..} = mempty-      & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- targetBuildDepends, x `notElem` internalLibNames ]+      & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- targetBuildDepends, x `notElem` internalLibNames ]       & system .~ Set.fromList [ resolveInNixpkgs y | x <- extraLibs, y <- libNixName x ]       & pkgconfig .~ Set.fromList [ resolveInNixpkgs y | PkgconfigDependency x _ <- pkgconfigDepends, y <- libNixName (unPkgconfigName x) ]       & tool .~ Set.fromList (map resolveInHackageThenNixpkgs . concatMap buildToolNixName@@ -166,7 +166,7 @@      convertSetupBuildInfo :: Cabal.SetupBuildInfo -> Nix.BuildInfo     convertSetupBuildInfo bi = mempty-      & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _) <- Cabal.setupDepends bi ]+      & haskell .~ Set.fromList [ resolveInHackage (toNixName x) | (Dependency x _ _) <- Cabal.setupDepends bi ]  bindNull :: Identifier -> Binding bindNull i = binding # (i, path # ["null"])
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs view
@@ -9,10 +9,13 @@   )   where +import Prelude hiding ( fail )+ import Control.DeepSeq import Control.Exception ( throwIO ) import Control.Lens-import Control.Monad+import Control.Monad hiding ( fail )+import Control.Monad.Fail import Data.Aeson import Data.Map as Map import Data.Set as Set@@ -91,7 +94,7 @@ readConfiguration :: FilePath -> IO Configuration readConfiguration path = decodeFileEither path >>= either throwIO assertConsistency -assertConsistency :: Monad m => Configuration -> m Configuration+assertConsistency :: MonadFail m => Configuration -> m Configuration assertConsistency cfg@Configuration {..} = do   let report msg = fail ("*** configuration error: " ++ msg)       maintainedPackages = Set.unions (Map.elems packageMaintainers)
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs view
@@ -45,6 +45,7 @@  | name == "io-streams"         = [enable "NoInteractiveTests"]  | name == "liquid-fixpoint"    = [enable "build-external"]  | name == "pandoc"             = [enable "https", disable "trypandoc"]+ | name == "pandoc-placetable"  = [enable "inlineMarkdown"]  | name == "persistent-sqlite"  = [enable "systemlib"]  | name == "reactive-banana-wx" = [disable "buildExamples"]  | name == "snap-server"        = [enable "openssl"]
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs view
@@ -47,7 +47,7 @@ libNixName "gconf-2.0"                          = return "GConf" libNixName "gdk-2.0"                            = return "gtk2" libNixName "gdk-3.0"                            = return "gtk3"-libNixName "gdk-pixbuf-2.0"                     = return "gdk_pixbuf"+libNixName "gdk-pixbuf-2.0"                     = return "gdk-pixbuf" libNixName "gdk-x11-2.0"                        = return "gdk_x11" libNixName "gdk-x11-3.0"                        = return "gtk3" libNixName "gio-2.0"                            = return "glib"@@ -109,6 +109,9 @@ libNixName "mpi"                                = return "openmpi" libNixName "ncursesw"                           = return "ncurses" libNixName "netsnmp"                            = return "net_snmp"+libNixName "nix-expr"                           = return "nix"+libNixName "nix-main"                           = return "nix"+libNixName "nix-store"                          = return "nix" libNixName "notify"                             = return "libnotify" libNixName "odbc"                               = return "unixODBC" libNixName "openblas"                           = return "openblasCompat"
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs view
@@ -21,7 +21,7 @@  postProcess :: Derivation -> Derivation postProcess deriv =- foldr (.) id [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]+ foldr (.) id [ f | (Dependency n vr _, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]  . fixGtkBuilds  . fixBuildDependsForTools  $ deriv
src/Distribution/Nixpkgs/Haskell/OrphanInstances.hs view
@@ -9,9 +9,12 @@ import Data.Yaml import Distribution.Compiler import Distribution.Package+import Distribution.Parsec import Distribution.System-import Distribution.Text+import Distribution.Pretty as Cabal+import qualified Data.Version as Base import Distribution.Version+import Language.Nix.PrettyPrinting as Nix  instance NFData CompilerInfo instance NFData AbiTag@@ -61,7 +64,25 @@   parseJSON (String s) = return (unknownCompilerInfo (fromString (T.unpack s)) NoAbiTag)   parseJSON s = fail ("parseJSON: " ++ show s ++ " is not a valid Haskell compiler") +instance Nix.Pretty Version where+  pPrint = pretty++instance Nix.Pretty PackageName where+  pPrint = pretty++instance Nix.Pretty PackageIdentifier where+  pPrint = pretty++instance Nix.Pretty CompilerId where+  pPrint = pretty++instance Nix.Pretty Platform where+  pPrint = pretty++instance Nix.Pretty Base.Version where+  pPrint = text . Base.showVersion+ -- parsing tools -text2isString :: Text a => String -> String -> a-text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParse s)+text2isString :: Parsec a => String -> String -> a+text2isString t s = fromMaybe (error ("fromString: " ++ show s ++ " is not a valid " ++ t)) (simpleParsec s)
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs view
@@ -11,16 +11,18 @@ import Data.List ( isSuffixOf, isPrefixOf ) import qualified Data.Map as DB import Data.Maybe+import qualified Data.Text as T+import qualified Data.Text.Encoding as T import Data.Time import Distribution.Nixpkgs.Fetch import Distribution.Nixpkgs.Hashes import qualified Distribution.Nixpkgs.Haskell.Hackage as DB+import Distribution.Nixpkgs.Haskell.OrphanInstances ( ) import qualified Distribution.Package as Cabal import Distribution.PackageDescription import qualified Distribution.PackageDescription as Cabal import Distribution.PackageDescription.Parsec as Cabal-import Distribution.Parsec.Common (showPError)-import Distribution.Text ( simpleParse, display )+import Distribution.Parsec import Distribution.Version import qualified Hpack.Config as Hpack import qualified Hpack.Render as Hpack@@ -29,8 +31,7 @@ import System.Exit ( exitFailure ) import System.FilePath ( (</>), (<.>) ) import System.IO-import qualified Data.Text as T-import qualified Data.Text.Encoding as T+import Text.PrettyPrint.HughesPJClass hiding ( first )  data HpackUse   = ForceHpack@@ -107,12 +108,12 @@   return (ds, setCabalFileHash (DB.cabalFileSha256 vd) (DB.cabalFile vd))  where   pkgId :: Cabal.PackageIdentifier-  pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)+  pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParsec pkg)   name = Cabal.packageName pkgId -  unknownPackageError = fail $ "No such package " ++ display pkgId ++ " in the cabal database. Did you run cabal update?"+  unknownPackageError = fail $ "No such package " ++ prettyShow pkgId ++ " in the cabal database. Did you run cabal update?" -  url = "mirror://hackage/" ++ display pkgId ++ ".tar.gz"+  url = "mirror://hackage/" ++ prettyShow pkgId ++ ".tar.gz"    version :: Version   version = Cabal.packageVersion pkgId@@ -175,7 +176,7 @@           exitFailure  showPackageIdentifier :: Cabal.GenericPackageDescription -> String-showPackageIdentifier pkgDesc = name ++ "-" ++ display version where+showPackageIdentifier pkgDesc = name ++ "-" ++ prettyShow version where   pkgId = Cabal.package . Cabal.packageDescription $ pkgDesc   name = Cabal.unPackageName (Cabal.packageName pkgId)   version = Cabal.packageVersion pkgId