Skip to content

Commit

Permalink
Use maybe instead of fromMaybe and fmap
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Jan 2, 2024
1 parent 67abfe1 commit ba86c63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ShellCheck/Analytics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ShellCheck/CFGAnalysis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ba86c63

Please sign in to comment.