Get rid of potentially

This already exists as sequence_.
This commit is contained in:
Joseph C. Sible 2020-02-09 20:10:09 -05:00
parent 4bfe6496d9
commit 7e6a556ef1
4 changed files with 32 additions and 41 deletions

View file

@ -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