git.iko.soy/typeable/cabal2nix
on master help sign in
Fix a bunch of hlint warnings.
commitfdd1c7e80bac65e0b5039f114b373996da8b5459 authorPeter Simons <simons@cryp.to> dateMon 5 Jan 2015, 23:19 (12 years ago) parent9cf7016
2 files changed+8−11
src/Cabal2Nix/Hackage.hs+1−1 src/hackage2nix.hs+7−10
src/Cabal2Nix/Hackage.hs+1−1
@@ -24,6 +24,6 @@ readHashedHackage = fmap parseUnparsedHackage Unparsed.readHackage
2424 hash = showDigest (sha256 buf)
2525 in
2626 pkg { packageDescription = (packageDescription pkg) {
27− customFieldsPD = ("x-cabal-file-hash", hash) : (customFieldsPD (packageDescription pkg))
27+ customFieldsPD = ("x-cabal-file-hash", hash) : customFieldsPD (packageDescription pkg)
2828 }
2929 }
src/hackage2nix.hs+7−10
@@ -61,7 +61,7 @@ generatePackageSet hackage nixpkgs = do
6161 putStrLn ""
6262 putStrLn "self: {"
6363 putStrLn ""
64− pkgs <- (flip parMapM) (Map.toList db) $ \(name, versions) -> do
64+ pkgs <- flip parMapM (Map.toList db) $ \(name, versions) -> do
6565 let multiVersionPackage :: Bool
6666 multiVersionPackage = Map.size versions > 1
6767
@@ -73,7 +73,7 @@ generatePackageSet hackage nixpkgs = do
7373
7474 let nixAttr = name ++ if multiVersionPackage then "_" ++ [ if c == '.' then '_' else c | c <- display version ] else ""
7575
76− let def = nest 2 $ hang ((string nixAttr) <+> equals <+> text "callPackage") 2 (parens (disp drv)) <+> (braces overrides <> semi)
76+ let def = nest 2 $ hang (string nixAttr <+> equals <+> text "callPackage") 2 (parens (disp drv)) <+> (braces overrides <> semi)
7777 let overr = if multiVersionPackage && version == defaultVersion
7878 then nest 2 $ (string name <+> equals <+> text ("self." ++ show nixAttr)) <> semi
7979 else empty
@@ -152,7 +152,7 @@ mergePackageSet = Map.unionWith Map.union
152152
153153-- These packages replace the latest respective version during dependency resolution.
154154defaultPackageOverrides :: [Dependency]
155−defaultPackageOverrides = map (\s -> maybe (error (show s ++ " is not a valid override selector")) id (simpleParse s))
155+defaultPackageOverrides = map (\s -> fromMaybe (error (show s ++ " is not a valid override selector")) (simpleParse s))
156156 [ "mtl == 2.1.*"
157157 , "monad-control == 0.3.*"
158158 ] ++
@@ -167,7 +167,7 @@ defaultPackageOverrides = map (\s -> maybe (error (show s ++ " is not a valid ov
167167extraPackages :: [Dependency]
168168extraPackages =
169169 map (\(Dependency name _) -> Dependency name anyVersion) defaultPackageOverrides ++
170− map (\s -> maybe (error (show s ++ " is not a valid extra package selector")) id (simpleParse s))
170+ map (\s -> fromMaybe (error (show s ++ " is not a valid extra package selector")) (simpleParse s))
171171 [
172172 ]
173173
@@ -227,7 +227,7 @@ cabal2nix resolver cabal = (missingDeps, flags, drv)
227227 where
228228 drv = (cabal2nix' descr) { configureFlags = [ "-f" ++ (if b then "" else "-") ++ n | (FlagName n, b) <- flags ] }
229229
230− Right (descr, flags) = finalize (if null missingDeps then resolver else (const True)) cabal
230+ Right (descr, flags) = finalize (if null missingDeps then resolver else const True) cabal
231231
232232 missingDeps :: [Dependency]
233233 missingDeps = either id (const []) (finalize resolver cabal')
@@ -251,11 +251,8 @@ cabal2nix resolver cabal = (missingDeps, flags, drv)
251251 enableTest :: TestSuite -> TestSuite
252252 enableTest t = t { testEnabled = True }
253253
254−
255−
256−
257254corePackages :: [PackageIdentifier] -- Core packages found on Hackageg
258−corePackages = map (\s -> maybe (error (show s ++ " is not a valid core package")) id (simpleParse s))
255+corePackages = map (\s -> fromMaybe (error (show s ++ " is not a valid core package")) (simpleParse s))
259256 [ "Cabal-1.18.1.5"
260257 , "array-0.5.0.0"
261258 , "base-4.7.0.2"
@@ -285,7 +282,7 @@ corePackages = map (\s -> maybe (error (show s ++ " is not a valid core package"
285282 ]
286283
287284hardCorePackages :: [PackageIdentifier] -- Core packages not found on Hackage.
288−hardCorePackages = map (\s -> maybe (error (show s ++ " is not a valid core package")) id (simpleParse s))
285+hardCorePackages = map (\s -> fromMaybe (error (show s ++ " is not a valid core package")) (simpleParse s))
289286 [ "bin-package-db-0.0.0.0"
290287 , "ghc-7.8.4"
291288 , "rts-1.0"