dev: lib: remove NOINLINE pragmas HLS doesn't complain about

This commit is contained in:
Simon Michael 2022-11-03 17:57:20 -10:00
parent 0608a76243
commit 5bc977442a
2 changed files with 0 additions and 13 deletions

View File

@ -171,8 +171,6 @@ progName =
-- unsafePerformIO and can be accessed from anywhere and before normal -- unsafePerformIO and can be accessed from anywhere and before normal
-- command-line processing. When running with :main in GHCI, you must -- 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. -- touch and reload this module to see the effect of a new --debug option.
-- {-# OPTIONS_GHC -fno-cse #-}
{-# NOINLINE debugLevel #-}
debugLevel :: Int debugLevel :: Int
debugLevel = case dropWhile (/="--debug") progArgs of debugLevel = case dropWhile (/="--debug") progArgs of
["--debug"] -> 1 ["--debug"] -> 1
@ -247,7 +245,6 @@ debugLogFile = progName ++ ".log"
-- | Log a string to the debug log before returning the second argument. -- | Log a string to the debug log before returning the second argument.
-- Uses unsafePerformIO. -- Uses unsafePerformIO.
{-# NOINLINE traceLog #-}
traceLog :: String -> a -> a traceLog :: String -> a -> a
traceLog s x = unsafePerformIO $ do traceLog s x = unsafePerformIO $ do
evaluate (force s) -- to complete any previous logging before we attempt more 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 dbg9 = ptraceOrLogAt 9
-- | Like dbg0, but also exit the program. Uses unsafePerformIO. -- | Like dbg0, but also exit the program. Uses unsafePerformIO.
{-# NOINLINE dbgExit #-}
dbgExit :: Show a => String -> a -> a dbgExit :: Show a => String -> a -> a
dbgExit label a = unsafePerformIO $ dbg0IO label a >> exitFailure dbgExit label a = unsafePerformIO $ dbg0IO label a >> exitFailure

View File

@ -110,22 +110,15 @@ colorOption =
-- and a NO_COLOR environment variable is not defined -- and a NO_COLOR environment variable is not defined
-- and stdout supports ANSI color and -o/--output-file was not used or is "-" -- and stdout supports ANSI color and -o/--output-file was not used or is "-"
-- ). -- ).
-- {-# OPTIONS_GHC -fno-cse #-}
-- {-# NOINLINE useColorOnStdout #-}
useColorOnStdout :: Bool useColorOnStdout :: Bool
useColorOnStdout = not hasOutputFile && useColorOnHandle stdout useColorOnStdout = not hasOutputFile && useColorOnHandle stdout
-- Avoid using dbg*, pshow etc. in this function (infinite loop). -- Avoid using dbg*, pshow etc. in this function (infinite loop).
-- | Like useColorOnStdout, but checks for ANSI color support on stderr, -- | Like useColorOnStdout, but checks for ANSI color support on stderr,
-- and is not affected by -o/--output-file. -- and is not affected by -o/--output-file.
-- {-# OPTIONS_GHC -fno-cse #-}
-- {-# NOINLINE useColorOnStdout #-}
useColorOnStderr :: Bool useColorOnStderr :: Bool
useColorOnStderr = useColorOnHandle stderr useColorOnStderr = useColorOnHandle stderr
-- sorry, I'm just cargo-culting these pragmas:
-- {-# OPTIONS_GHC -fno-cse #-}
-- {-# NOINLINE useColorOnHandle #-}
useColorOnHandle :: Handle -> Bool useColorOnHandle :: Handle -> Bool
useColorOnHandle h = unsafePerformIO $ do useColorOnHandle h = unsafePerformIO $ do
no_color <- isJust <$> lookupEnv "NO_COLOR" no_color <- isJust <$> lookupEnv "NO_COLOR"
@ -157,8 +150,6 @@ outputFileOption =
-- | Check whether the -o/--output-file option has been used at program startup -- | Check whether the -o/--output-file option has been used at program startup
-- with an argument other than "-", using unsafePerformIO. -- with an argument other than "-", using unsafePerformIO.
-- {-# OPTIONS_GHC -fno-cse #-}
-- {-# NOINLINE hasOutputFile #-}
hasOutputFile :: Bool hasOutputFile :: Bool
hasOutputFile = outputFileOption `notElem` [Nothing, Just "-"] hasOutputFile = outputFileOption `notElem` [Nothing, Just "-"]