packages feed

weeder 0.1.9 → 0.1.10

raw patch · 6 files changed

+34/−13 lines, 6 filesdep +semigroupsdep ~base

Dependencies added: semigroups

Dependency ranges changed: base

Files

CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for Weeder +0.1.10+    Make --verbose print out the directory when running commands+    Don't report semigroups as unused on any platforms 0.1.9, released 2017-12-07     Don't report Win32/unix as unused on the alternate platform 0.1.8, released 2017-12-06
src/Cabal.hs view
@@ -17,7 +17,7 @@ import Data.List.Extra import Data.Tuple.Extra import Data.Either.Extra-import Data.Monoid+import Data.Semigroup import Prelude  @@ -54,9 +54,12 @@     ,cabalSections :: [CabalSection]     } deriving Show +instance Semigroup Cabal where+    Cabal x1 x2 <> Cabal y1 y2 = Cabal (x1?:y1) (x2++y2)+ instance Monoid Cabal where     mempty = Cabal "" []-    mappend (Cabal x1 x2) (Cabal y1 y2) = Cabal (x1?:y1) (x2++y2)+    mappend = (<>)  data CabalSectionType = Library | Executable String | TestSuite String | Benchmark String     deriving (Eq,Ord)@@ -90,11 +93,13 @@     ,cabalPackages :: [PackageName]     } deriving Show -instance Monoid CabalSection where-    mempty = CabalSection Library "" [] [] [] []-    mappend (CabalSection x1 x2 x3 x4 x5 x6) (CabalSection y1 y2 y3 y4 y5 y6) =+instance Semigroup CabalSection where+    CabalSection x1 x2 x3 x4 x5 x6 <> CabalSection y1 y2 y3 y4 y5 y6 =         CabalSection x1 (x2?:y2) (x3<>y3) (x4<>y4) (x5<>y5) (x6<>y6) +instance Monoid CabalSection where+    mempty = CabalSection Library "" [] [] [] []+    mappend = (<>)  parseCabal :: FilePath -> IO Cabal parseCabal = fmap parseTop . readFile'
src/Check.hs view
@@ -52,7 +52,9 @@     | (CabalSection{..}, (x1,x2)) <- sections     , let usedPackages = Set.unions $ map (Set.map fst . hiImportPackageModule . hi) $ x1 ++ x2     , p <- Set.toList $ Set.fromList cabalPackages `Set.difference` usedPackages-    , p /= if isWindows then "unix" else "Win32"] -- ignore packages that must be conditional on the other platform+    , p /= if isWindows then "unix" else "Win32" -- ignore packages that must be conditional on the other platform+    , p /= "semigroups" -- ignore packages that are often conditional+    ]   warnIncorrectOtherModules :: S -> [Warning]
src/Hi.hs view
@@ -19,7 +19,7 @@ import Data.Char import Data.Hashable import Data.List.Extra-import Data.Monoid+import Data.Semigroup import Data.Functor import Util import qualified Str as S@@ -55,9 +55,8 @@ instance Hashable Hi instance NFData Hi -instance Monoid Hi where-    mempty = Hi mempty mempty mempty mempty mempty mempty mempty mempty mempty-    mappend x y = Hi+instance Semigroup Hi where+    x <> y = Hi         {hiModuleName = f (?:) hiModuleName         ,hiImportPackage = f (<>) hiImportPackage         ,hiExportIdent = f (<>) hiExportIdent@@ -69,6 +68,10 @@         ,hiFieldName = f (<>) hiFieldName         }         where f op sel = sel x `op` sel y++instance Monoid Hi where+    mempty = Hi mempty mempty mempty mempty mempty mempty mempty mempty mempty+    mappend = (<>)  -- | Don't expose that we're just using the filename internally newtype HiKey = HiKey FilePath deriving (Eq,Ord,Hashable)
src/Util.hs view
@@ -19,6 +19,7 @@ import Data.List.Extra import Data.Tuple.Extra import System.Process+import System.Directory import System.Console.CmdArgs.Verbosity import Str(Str) import qualified Str as S@@ -82,12 +83,17 @@ isPathsModule = isPrefixOf "Paths_"  +cmdTrace :: FilePath -> [String] -> IO ()+cmdTrace exe args = whenLoud $ do+    dir <- getCurrentDirectory+    putStrLn $ "Running: " ++ showCommandForUser exe args ++ " (in " ++ dir ++ ")"+ cmd :: FilePath -> [String] -> IO () cmd exe args = do-    whenLoud $ putStrLn $ "Running: " ++ showCommandForUser exe args+    cmdTrace exe args     callProcess exe args  cmdStdout :: FilePath -> [String] -> IO String cmdStdout exe args = do-    whenLoud $ putStrLn $ "Running: " ++ showCommandForUser exe args+    cmdTrace exe args     readCreateProcess (proc exe args) ""
weeder.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.18 build-type:         Simple name:               weeder-version:            0.1.9+version:            0.1.10 license:            BSD3 license-file:       LICENSE category:           Development@@ -26,6 +26,8 @@     default-language:   Haskell2010     main-is:            Main.hs     hs-source-dirs:     src+    if impl(ghc < 8.0)+        build-depends: semigroups >= 0.18     build-depends:         base >= 4.6 && < 5,         text,