Make skipRepeating lazier and faster
This commit is contained in:
parent
01f4423465
commit
5084ba8d7e
|
@ -966,9 +966,9 @@ checkCatastrophicRm = CommandCheck (Basename "rm") $ \t ->
|
|||
f _ = return ""
|
||||
|
||||
stripTrailing c = reverse . dropWhile (== c) . reverse
|
||||
skipRepeating c (a:b:rest) | a == b && b == c = skipRepeating c (b:rest)
|
||||
skipRepeating c (a:r) = a:skipRepeating c r
|
||||
skipRepeating _ [] = []
|
||||
skipRepeating c = foldr go []
|
||||
where
|
||||
go a r = a : if a == c then case r of b:rest | b == c -> rest; _ -> r else r
|
||||
|
||||
paths = [
|
||||
"", "/bin", "/etc", "/home", "/mnt", "/usr", "/usr/share", "/usr/local",
|
||||
|
|
Loading…
Reference in New Issue