mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-08 05:51:09 -07:00
Get rid of potentially
This already exists as sequence_.
This commit is contained in:
parent
4bfe6496d9
commit
7e6a556ef1
4 changed files with 32 additions and 41 deletions
|
@ -870,15 +870,6 @@ getBracedModifier s = fromMaybe "" . listToMaybe $ do
|
|||
|
||||
-- Useful generic functions.
|
||||
|
||||
-- Run an action in a Maybe (or do nothing).
|
||||
-- Example:
|
||||
-- potentially $ do
|
||||
-- s <- getLiteralString cmd
|
||||
-- guard $ s `elem` ["--recursive", "-r"]
|
||||
-- return $ warn .. "Something something recursive"
|
||||
potentially :: Monad m => Maybe (m ()) -> m ()
|
||||
potentially = fromMaybe (return ())
|
||||
|
||||
-- Get element 0 or a default. Like `head` but safe.
|
||||
headOrDefault _ (a:_) = a
|
||||
headOrDefault def _ = def
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue