Skip to content

Commit 0caafdd

Browse files
authored
Merge pull request #660 from alexfmpe/warnings
Fix warnings
2 parents c223aab + b533bce commit 0caafdd

File tree

13 files changed

+28
-33
lines changed

13 files changed

+28
-33
lines changed

cabal2nix/cabal2nix.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ library
5555
, Cabal >= 3.0
5656
, aeson > 1
5757
, ansi-terminal
58-
, ansi-wl-pprint
5958
, bytestring
6059
, containers >= 0.5.9
6160
, deepseq >= 1.4
@@ -69,6 +68,7 @@ library
6968
, lens
7069
, optparse-applicative
7170
, pretty >= 1.1.2
71+
, prettyprinter
7272
, process
7373
, split
7474
, text

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/Cabal2nix.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import Options.Applicative
3838
import Paths_cabal2nix ( version )
3939
import System.Environment ( getArgs )
4040
import System.IO ( hFlush, stdout, stderr )
41-
import qualified Text.PrettyPrint.ANSI.Leijen as P2
41+
import qualified Prettyprinter as P2
4242
import Text.PrettyPrint.HughesPJClass ( Doc, Pretty(..), text, vcat, hcat, semi, render, prettyShow )
4343

4444
{-# ANN module ("HLint: ignore Use Just" :: String) #-}
@@ -148,16 +148,16 @@ pinfo = info
148148
( fullDesc
149149
<> header "cabal2nix converts Cabal files into build instructions for Nix."
150150
<> progDescDoc (Just (P2.vcat
151-
[ P2.text ""
152-
, P2.text "Recognized URI schemes:"
153-
, P2.text ""
154-
, P2.text " cabal://pkgname-pkgversion download the specified package from Hackage"
155-
, P2.text " cabal://pkgname download latest version of this package from Hackage"
156-
, P2.text " file:///local/path load the Cabal file from the local disk"
157-
, P2.text " /local/path abbreviated version of file URI"
158-
, P2.text " <git/svn/bzr/hg URL> download the source from the specified repository"
159-
, P2.text ""
160-
, P2.fillSep (map P2.text (words ( "If the URI refers to a cabal file, information for building the package "
151+
[ ""
152+
, "Recognized URI schemes:"
153+
, ""
154+
, " cabal://pkgname-pkgversion download the specified package from Hackage"
155+
, " cabal://pkgname download latest version of this package from Hackage"
156+
, " file:///local/path load the Cabal file from the local disk"
157+
, " /local/path abbreviated version of file URI"
158+
, " <git/svn/bzr/hg URL> download the source from the specified repository"
159+
, ""
160+
, P2.fillSep (map P2.pretty (words ( "If the URI refers to a cabal file, information for building the package "
161161
++ "will be retrieved from that file, but hackage will be used as a source "
162162
++ "for the derivation. Otherwise, the supplied URI will be used to as the "
163163
++ "source for the derivation and the information is taken from the cabal file "

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))

cabal2nix/src/Distribution/Nixpkgs/Haskell/FromCabal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ import Distribution.System
2929
import Distribution.Types.PackageVersionConstraint
3030
import Distribution.Text ( display )
3131
import Distribution.Types.ComponentRequestedSpec as Cabal
32+
#if !MIN_VERSION_Cabal(3,8,1)
3233
import Distribution.Types.ExeDependency as Cabal
3334
import Distribution.Types.LegacyExeDependency as Cabal
3435
import Distribution.Types.PkgconfigDependency as Cabal
3536
import Distribution.Types.UnqualComponentName as Cabal
37+
#endif
3638
import Distribution.Utils.ShortText ( fromShortText )
3739
import Distribution.Version
3840
import Language.Nix

cabal2nix/src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import Distribution.Compiler
2525
import Distribution.Nixpkgs.Haskell.Constraint
2626
import Distribution.Nixpkgs.Meta
2727
import Distribution.Package
28-
import Distribution.System
2928
import GHC.Generics ( Generic )
3029
import Language.Nix.Identifier
3130

distribution-nixpkgs/src/Distribution/Nixpkgs/Meta.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Prelude hiding ( (<>) )
2525
#endif
2626
import Control.Applicative ( (<|>) )
2727
import Control.DeepSeq
28-
import Control.Lens hiding ( Strict )
28+
import Control.Lens hiding ( Strict, element )
2929
import Data.List ( stripPrefix )
3030
import Data.Set ( Set )
3131
import qualified Data.Set as Set
@@ -400,10 +400,10 @@ renderPlatforms field ps
400400

401401
-- append lib.platforms list via nix's ++ at the end
402402
-- if there is no cabal platforms list, don't emit leading ++
403-
appendNixpkgsP acc elem = acc $$
403+
appendNixpkgsP acc element = acc $$
404404
if isEmpty acc && Set.null cabalPs
405-
then nest 3 $ pPrint elem
406-
else text "++" <+> pPrint elem
405+
then nest 3 $ pPrint element
406+
else text "++" <+> pPrint element
407407
renderedNixpkgsPs = Set.foldl' appendNixpkgsP mempty nixpkgsPs
408408

409409
-- Helper function, roughly the inverse of nixpkgs' optionals

hackage-db/example/list-known-versions.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Distribution.Hackage.DB.Unparsed
55

66
import Control.Monad
77
import qualified Data.ByteString as BS
8-
import Data.List as List
8+
import qualified Data.List as List
99
import Data.Map as Map
1010
import Distribution.Text
1111

@@ -14,4 +14,4 @@ main = do
1414
db <- hackageTarball >>= readTarball Nothing
1515
forM_ (toList db) $ \(pn, PackageData vr vs) -> do
1616
let pref = if BS.null vr then "" else " (preferred: " ++ show vr ++ ")"
17-
putStrLn $ display pn ++ ": " ++ intercalate ", " (fmap display (keys vs)) ++ pref
17+
putStrLn $ display pn ++ ": " ++ List.intercalate ", " (fmap display (keys vs)) ++ pref

hackage-db/src/Distribution/Hackage/DB/Parsed.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import qualified Distribution.Hackage.DB.Unparsed as U
1414
import Distribution.Hackage.DB.Utility
1515

1616
import Codec.Archive.Tar
17-
import Codec.Archive.Tar.Entry
1817
import Control.Exception
1918
import Control.Monad.Catch
2019
import Data.ByteString as BSS

hackage-db/src/Distribution/Hackage/DB/Unparsed.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import Distribution.Hackage.DB.Builder ( Builder(..) )
1818
import Distribution.Hackage.DB.Utility
1919

2020
import Codec.Archive.Tar as Tar
21-
import Codec.Archive.Tar.Entry as Tar
22-
import Control.Exception
2321
import Control.Monad.Catch
2422
import Data.ByteString ( ByteString )
2523
import Data.ByteString.Lazy ( toStrict )
@@ -28,7 +26,6 @@ import Data.Time.Clock
2826
import Distribution.Types.PackageName
2927
import Distribution.Types.Version
3028
import GHC.Generics ( Generic )
31-
import System.FilePath
3229

3330
type HackageDB = Map PackageName PackageData
3431

0 commit comments

Comments
 (0)