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