From ba86c6363c30a5dbefd0b8b9a7c5f4ab0478dc91 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Tue, 2 Jan 2024 14:46:07 -0500 Subject: [PATCH] Use maybe instead of fromMaybe and fmap --- src/ShellCheck/Analytics.hs | 2 +- src/ShellCheck/CFGAnalysis.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index 71caa62d0..3af0455db 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -5020,7 +5020,7 @@ checkPlusEqualsNumber params t = let unquotedLiteral = getUnquotedLiteral word isEmpty = unquotedLiteral == Just "" - isUnquotedNumber = not isEmpty && fromMaybe False (all isDigit <$> unquotedLiteral) + isUnquotedNumber = not isEmpty && maybe False (all isDigit) unquotedLiteral isNumericalVariableName = fromMaybe False $ do str <- unquotedLiteral CF.variableMayBeAssignedInteger state str diff --git a/src/ShellCheck/CFGAnalysis.hs b/src/ShellCheck/CFGAnalysis.hs index 16afa6864..0b99c9f71 100644 --- a/src/ShellCheck/CFGAnalysis.hs +++ b/src/ShellCheck/CFGAnalysis.hs @@ -829,7 +829,7 @@ lookupStack' functionOnly get dep def ctx key = do f (s:rest) = do -- Go up the stack until we find the value, and add -- a dependency on each state (including where it was found) - res <- fromMaybe (f rest) (return <$> get (stackState s) key) + res <- maybe (f rest) return (get (stackState s) key) modifySTRef (dependencies s) $ S.insert $ dep key res return res