diff options
-rw-r--r-- | hadrian/src/Target.hs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/hadrian/src/Target.hs b/hadrian/src/Target.hs index 07a31fc464..3655cd5047 100644 --- a/hadrian/src/Target.hs +++ b/hadrian/src/Target.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE LambdaCase #-} + module Target ( Target, target, context, builder, inputs, outputs, trackArgument, module Builder @@ -25,8 +27,14 @@ trackArgument target arg = case builder target of Cabal _ _ -> not $ verbosityArg arg || cabal_configure_ignore arg _ -> True where - threadArg s = dropWhileEnd isDigit s `elem` ["-j", "MAKEFLAGS=-j", "THREADS="] - verbosityArg s = dropWhileEnd isDigit s == "-v" + match_str_num [] rs = all isDigit rs + match_str_num (x:xs) (r:rs) = x == r && match_str_num xs rs + match_str_num (_:_) [] = False + + threadArg s = match_str_num "-j" s || match_str_num "MAKEFLAGS=-j" s || match_str_num "THREADS=" s + verbosityArg s = match_str_num "-v" s diagnosticsColorArg s = "-fdiagnostics-color=" `isPrefixOf` s -- N.B. #18672 - cabal_configure_ignore s = - s `elem` [ "--configure-option=--quiet", "--configure-option=--disable-option-checking" ] + cabal_configure_ignore = \case + "--configure-option=--quiet" -> True + "--configure-option=--disable-option-checking" -> True + _ -> False |