Skip to content

Commit 8fd782a

Browse files
committed
Fix warning: -Wx-partial
1 parent 6ba3f49 commit 8fd782a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cabal2nix/hackage2nix/HackageGit.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Control.Lens hiding ( (<.>) )
1111
import Control.Monad
1212
import Data.Aeson
1313
import qualified Data.ByteString.Char8 as BS
14+
import qualified Data.List as List
1415
import Data.Map as Map
1516
import Data.Set as Set
1617
import Data.String
@@ -38,7 +39,7 @@ readHackage path = getSubDirs path >>= foldM discoverPackageVersions mempty
3839
getSubDirs :: FilePath -> IO [FilePath]
3940
getSubDirs path = do
4041
let isDirectory p = doesDirectoryExist (path </> p)
41-
getDirectoryContents path >>= filterM isDirectory . Prelude.filter (\x -> head x /= '.')
42+
getDirectoryContents path >>= filterM isDirectory . Prelude.filter (not . List.isPrefixOf ".")
4243

4344
type SHA256Hash = String
4445

cabal2nix/src/Distribution/Nixpkgs/Fetch.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,12 @@ fetchWith (supportsRev, kind) source = do
258258
[] -> error "This can't happen, but GHC doesn't know that."
259259
(x:xs) -> (x,xs)
260260
buf' = BS.unlines (reverse ls)
261-
case length ls of
262-
0 -> return Nothing
263-
1 -> return (Just (DerivationSource { derivKind = Just kind
261+
case ls of
262+
[] -> return Nothing
263+
[hash] -> return (Just (DerivationSource { derivKind = Just kind
264264
, derivUrl = sourceUrl source
265265
, derivRevision = ""
266-
, derivHash = BS.unpack (head ls)
266+
, derivHash = BS.unpack hash
267267
, derivSubmodule = Nothing
268268
}
269269
, BS.unpack l))

0 commit comments

Comments
 (0)