Use isJust instead of reimplementing it

This commit is contained in:
Joseph C. Sible 2020-02-09 23:06:12 -05:00
parent 6d06103cab
commit d5c5128115
1 changed files with 1 additions and 2 deletions

View File

@ -456,11 +456,10 @@ checkEchoSed = ForShell [Bash, Ksh] f
-- This should have used backreferences, but TDFA doesn't support them
sedRe = mkRegex "^s(.)([^\n]*)g?$"
isSimpleSed s = fromMaybe False $ do
isSimpleSed s = isJust $ do
[h:_,rest] <- matchRegex sedRe s
let delimiters = filter (== h) rest
guard $ length delimiters == 2
return True
checkIn id s =
when (isSimpleSed s) $
style id 2001 "See if you can use ${variable//search/replace} instead."