aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-07-31 14:15:03 +0200
committerDaniel Gröber (dxld) <dxld@darkboxed.org>2019-09-17 17:48:26 +0200
commit82777ce96e1ddad02033adc2f0c0c6f548e850ac (patch)
tree564cc05e2cfcf5186d72d6561b06ffa6b4a62354 /src
parenta59d7b1f56ff7d206bbddcd3647ab39e46a7c4aa (diff)
Fix some warnings
I'm turning off -Wunused-imports in the modules that have to deal with ancient Cabal versions because maintaining warning cleanlyness really is quite pointless when you have to deal with all sorts of deprecations and stuff moving around. I don't think having too many imports will ever break anything there unless the modules really get deprecated and removed, but we'll notice that ;)
Diffstat (limited to 'src')
-rw-r--r--src/CabalHelper/Compiletime/Program/Stack.hs10
-rw-r--r--src/CabalHelper/Compiletime/Types.hs1
-rw-r--r--src/CabalHelper/Runtime/Compat.hs1
-rw-r--r--src/CabalHelper/Runtime/HelperMain.hs4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/CabalHelper/Compiletime/Program/Stack.hs b/src/CabalHelper/Compiletime/Program/Stack.hs
index f0dd766..353e8f1 100644
--- a/src/CabalHelper/Compiletime/Program/Stack.hs
+++ b/src/CabalHelper/Compiletime/Program/Stack.hs
@@ -46,11 +46,7 @@ import CabalHelper.Compiletime.Types.RelativePath
import CabalHelper.Shared.Common
getUnit :: QueryEnvI c 'Stack -> CabalFile -> IO (Unit 'Stack)
-getUnit
- qe@QueryEnv{qeProjLoc=ProjLocStackYaml stack_yaml}
- cabal_file@(CabalFile cabal_file_path)
- = do
- let projdir = takeDirectory stack_yaml
+getUnit qe cabal_file@(CabalFile cabal_file_path) = do
let pkgdir = takeDirectory cabal_file_path
let pkg_name = dropExtension $ takeFileName cabal_file_path
look <- paths qe pkgdir
@@ -91,7 +87,7 @@ listPackageCabalFiles qe@QueryEnv{qeProjLoc=ProjLocStackYaml stack_yaml}
return $ map CabalFile $ lines out
where
ioerror :: IOError -> IO a
- ioerror ioe = (=<<) (fromMaybe (throwIO ioe)) $ runMaybeT $ do
+ ioerror ioe = (fromMaybe (throwIO ioe) =<<) $ runMaybeT $ do
stack_exe <- MaybeT $ findExecutable $ stackProgram $ qePrograms qe
stack_ver_str
<- liftIO $ trim <$> readStackCmd qe Nothing ["--numeric-version"]
@@ -116,6 +112,8 @@ listPackageCabalFiles qe@QueryEnv{qeProjLoc=ProjLocStackYaml stack_yaml}
workdirArg :: QueryEnvI c 'Stack -> [String]
workdirArg QueryEnv{qeDistDir=DistDirStack mworkdir} =
maybeToList $ ("--work-dir="++) . unRelativePath <$> mworkdir
+workdirArg QueryEnv{qeDistDir=DistDirCabal{}} =
+ error "workdirArg: TODO: this case is impossible and should not produce an exhaustiveness warning anymore starting with GHC 8.8"
doStackCmd :: (QueryEnvI c 'Stack -> CallProcessWithCwd a)
-> QueryEnvI c 'Stack -> Maybe FilePath -> [String] -> IO a
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs
index cded136..e79c812 100644
--- a/src/CabalHelper/Compiletime/Types.hs
+++ b/src/CabalHelper/Compiletime/Types.hs
@@ -32,7 +32,6 @@ import Data.IORef
import Data.Version
import Data.Typeable
import GHC.Generics
-import System.FilePath
import System.Posix.Types
import CabalHelper.Compiletime.Types.RelativePath
import CabalHelper.Shared.InterfaceTypes
diff --git a/src/CabalHelper/Runtime/Compat.hs b/src/CabalHelper/Runtime/Compat.hs
index 0c5a895..1673b7a 100644
--- a/src/CabalHelper/Runtime/Compat.hs
+++ b/src/CabalHelper/Runtime/Compat.hs
@@ -16,6 +16,7 @@
{-# LANGUAGE CPP, BangPatterns, RecordWildCards, RankNTypes, ViewPatterns,
TupleSections #-}
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef MIN_VERSION_Cabal
#undef CH_MIN_VERSION_Cabal
diff --git a/src/CabalHelper/Runtime/HelperMain.hs b/src/CabalHelper/Runtime/HelperMain.hs
index b4ba6cc..a3119e5 100644
--- a/src/CabalHelper/Runtime/HelperMain.hs
+++ b/src/CabalHelper/Runtime/HelperMain.hs
@@ -16,7 +16,7 @@
{-# LANGUAGE CPP, BangPatterns, RecordWildCards, RankNTypes, ViewPatterns,
TupleSections #-}
-
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{- # OPTIONS_GHC -Wno-missing-signatures #-}
{- # OPTIONS_GHC -fno-warn-incomplete-patterns #-}
@@ -512,6 +512,7 @@ componentOptions' (lbi, v, distdir) inplaceFlag flags rf f = do
#else
[] -> removeInplaceDeps v lbi pd clbi
#endif
+ _ -> error $ "invalid flags: " ++ show flags
opts = componentGhcOptions normal lbi bi clbi' outdir
opts' = f opts
@@ -686,6 +687,7 @@ combineEp (Just ChSetupEntrypoint) e = e
combineEp (Just (ChLibEntrypoint es1 os1 ss1)) (ChLibEntrypoint es2 os2 ss2) = (ChLibEntrypoint (nub $ es2++es1) (nub $ os2++os1) (nub $ ss2++ss1))
combineEp _ e@(ChExeEntrypoint _mi _os2) = error $ "combineEP: cannot have a sub exe:" ++ show e
combineEp (Just (ChExeEntrypoint mi os1)) (ChLibEntrypoint es2 os2 ss2) = (ChExeEntrypoint mi (nub $ os1++es2++os2++ss2))
+combineEp me e = error $ "combineEp: undhandled case: " ++ show (me, e)
-- no, you unconditionally always wrap the result in Just, so instead of `f x = Just y; f x = Just z` do `f x = y; f x = z` and use f as `Just . f`