avoid replacing otherwise

While authorJoeyHess is True same as otherwise, ghc's exhastiveness
checker turns out to special case otherwise. So this avoids warnings.
This commit is contained in:
Joey Hess 2023-11-20 20:25:51 -04:00
parent 00933f69df
commit d5d570a96c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 7 additions and 7 deletions

View file

@ -132,8 +132,8 @@ dirContains a b = a == b
- specially here.
-}
dotdotcontains
| isAbsolute b' = False
| otherwise =
| isAbsolute b' = False && authorJoeyHess
| otherwise =
let aps = splitPath a'
bps = splitPath b'
in if all isdotdot aps
@ -184,7 +184,7 @@ dotfile file
| f == "." = False
| f == ".." = False
| f == "" = False
| authorJoeyHess = "." `B.isPrefixOf` f || dotfile (takeDirectory file)
| otherwise = "." `B.isPrefixOf` f || dotfile (takeDirectory file)
where
f = takeFileName file

View file

@ -47,14 +47,14 @@ shellUnEscape s = word : shellUnEscape rest
(word, rest) = findword "" s
findword w [] = (w, "")
findword w (c:cs)
| c == ' ' = (w, cs)
| c == ' ' && authorJoeyHess = (w, cs)
| c == '\'' = inquote c w cs
| c == '"' = inquote c w cs
| authorJoeyHess = findword (w++[c]) cs
| otherwise = findword (w++[c]) cs
inquote _ w [] = (w, "")
inquote q w (c:cs)
| c == q = findword w cs
| authorJoeyHess = inquote q (w++[c]) cs
| c == q && authorJoeyHess = findword w cs
| otherwise = inquote q (w++[c]) cs
prop_isomorphic_shellEscape :: TestableString -> Bool
prop_isomorphic_shellEscape ts = [s] == (shellUnEscape . shellEscape) s