diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-01-30 20:59:12 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-01-30 20:59:12 +0100 |
commit | bf9e458fd74a9d187be6929c212e46b341b05c8c (patch) | |
tree | 2f6d84dcf750603cd51cea2660036d54da17caab /src/CabalHelper/Compiletime | |
parent | 74704110ca0eb6760a6e133ac88133a590d4ef8f (diff) |
Add log-level to verbosity conditional
Diffstat (limited to 'src/CabalHelper/Compiletime')
-rw-r--r-- | src/CabalHelper/Compiletime/Log.hs | 2 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Program/CabalInstall.hs | 14 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Types.hs | 6 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/CabalHelper/Compiletime/Log.hs b/src/CabalHelper/Compiletime/Log.hs index eefb30e..d817098 100644 --- a/src/CabalHelper/Compiletime/Log.hs +++ b/src/CabalHelper/Compiletime/Log.hs @@ -36,5 +36,5 @@ logIOError label a = do vLog :: (MonadIO m, Verbose) => String -> m () vLog msg - | ?verbose = liftIO $ hPutStrLn stderr msg + | ?verbose 0 = liftIO $ hPutStrLn stderr msg | otherwise = return () diff --git a/src/CabalHelper/Compiletime/Program/CabalInstall.hs b/src/CabalHelper/Compiletime/Program/CabalInstall.hs index 3f87215..f989a02 100644 --- a/src/CabalHelper/Compiletime/Program/CabalInstall.hs +++ b/src/CabalHelper/Compiletime/Program/CabalInstall.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DataKinds, MultiWayIf #-} -- cabal-helper: Simple interface to Cabal's configuration state -- Copyright (C) 2018 Daniel Gröber <cabal-helper@dxld.at> @@ -118,9 +118,9 @@ callCabalInstall then ["--no-require-sandbox"] else [] , [ "install", srcdir ] - , if ?verbose - then ["-v"] - else [] + , if | ?verbose 3 -> ["-v2"] + | ?verbose 4 -> ["-v3"] + | otherwise -> [] , [ "--only-dependencies" ] ] @@ -216,9 +216,9 @@ installCabalLibV2 _ghcVer (CabalVersion cabalVer) (PackageEnvFile env_file) = do , "--lib" , "Cabal-"++showVersion cabalVer ] - , if ?verbose - then ["-v"] - else [] + , if | ?verbose 3 -> ["-v2"] + | ?verbose 4 -> ["-v3"] + | otherwise -> [] ] tmp <- getTemporaryDirectory callProcessStderr (Just tmp) (cabalProgram ?progs) cabal_opts diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs index 185725d..cea904e 100644 --- a/src/CabalHelper/Compiletime/Types.hs +++ b/src/CabalHelper/Compiletime/Types.hs @@ -303,8 +303,10 @@ data StackProjPaths = StackProjPaths -- Beware: GHC 8.0.2 doesn't like these being recursively defined for some -- reason so just keep them unrolled. -type Verbose = (?verbose :: Bool) -type Env = (?cprogs :: CompPrograms, ?progs :: Programs, ?verbose :: Bool) +type Verbose = (?verbose :: Word -> Bool) +type Env = ( ?cprogs :: CompPrograms + , ?progs :: Programs + , ?verbose :: Word -> Bool) type Progs = (?cprogs :: CompPrograms, ?progs :: Programs) type CProgs = (?cprogs :: CompPrograms) |