mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 21:02:04 +03:00
dev: lib: remove NOINLINE pragmas HLS doesn't complain about
This commit is contained in:
parent
0608a76243
commit
5bc977442a
@ -171,8 +171,6 @@ progName =
|
||||
-- unsafePerformIO and can be accessed from anywhere and before normal
|
||||
-- command-line processing. When running with :main in GHCI, you must
|
||||
-- touch and reload this module to see the effect of a new --debug option.
|
||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||
{-# NOINLINE debugLevel #-}
|
||||
debugLevel :: Int
|
||||
debugLevel = case dropWhile (/="--debug") progArgs of
|
||||
["--debug"] -> 1
|
||||
@ -247,7 +245,6 @@ debugLogFile = progName ++ ".log"
|
||||
|
||||
-- | Log a string to the debug log before returning the second argument.
|
||||
-- Uses unsafePerformIO.
|
||||
{-# NOINLINE traceLog #-}
|
||||
traceLog :: String -> a -> a
|
||||
traceLog s x = unsafePerformIO $ do
|
||||
evaluate (force s) -- to complete any previous logging before we attempt more
|
||||
@ -360,7 +357,6 @@ dbg9 :: Show a => String -> a -> a
|
||||
dbg9 = ptraceOrLogAt 9
|
||||
|
||||
-- | Like dbg0, but also exit the program. Uses unsafePerformIO.
|
||||
{-# NOINLINE dbgExit #-}
|
||||
dbgExit :: Show a => String -> a -> a
|
||||
dbgExit label a = unsafePerformIO $ dbg0IO label a >> exitFailure
|
||||
|
||||
|
@ -110,22 +110,15 @@ colorOption =
|
||||
-- and a NO_COLOR environment variable is not defined
|
||||
-- and stdout supports ANSI color and -o/--output-file was not used or is "-"
|
||||
-- ).
|
||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||
-- {-# NOINLINE useColorOnStdout #-}
|
||||
useColorOnStdout :: Bool
|
||||
useColorOnStdout = not hasOutputFile && useColorOnHandle stdout
|
||||
|
||||
-- Avoid using dbg*, pshow etc. in this function (infinite loop).
|
||||
-- | Like useColorOnStdout, but checks for ANSI color support on stderr,
|
||||
-- and is not affected by -o/--output-file.
|
||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||
-- {-# NOINLINE useColorOnStdout #-}
|
||||
useColorOnStderr :: Bool
|
||||
useColorOnStderr = useColorOnHandle stderr
|
||||
|
||||
-- sorry, I'm just cargo-culting these pragmas:
|
||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||
-- {-# NOINLINE useColorOnHandle #-}
|
||||
useColorOnHandle :: Handle -> Bool
|
||||
useColorOnHandle h = unsafePerformIO $ do
|
||||
no_color <- isJust <$> lookupEnv "NO_COLOR"
|
||||
@ -157,8 +150,6 @@ outputFileOption =
|
||||
|
||||
-- | Check whether the -o/--output-file option has been used at program startup
|
||||
-- with an argument other than "-", using unsafePerformIO.
|
||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||
-- {-# NOINLINE hasOutputFile #-}
|
||||
hasOutputFile :: Bool
|
||||
hasOutputFile = outputFileOption `notElem` [Nothing, Just "-"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user