I find myself rewriting functions like these a lot:
hidden :: Path Rel File -> Bool
hidden = goFile
where
goFile :: Path Rel File -> Bool
goFile f = isHiddenIn (parent f) f || goDir (parent f)
goDir :: Path Rel Dir -> Bool
goDir f
| parent f == f = False
| otherwise = isHiddenIn (parent f) f || goDir (parent f)
isHiddenIn :: Path b Dir -> Path b t -> Bool
isHiddenIn curdir ad =
case stripProperPrefix curdir ad of
Nothing -> False
Just rp -> "." `isPrefixOf` toFilePath rp
Would it be valuable to put them into the path library?
I find myself rewriting functions like these a lot:
Would it be valuable to put them into the
path
library?