LIB: simplify symlink pattern matching via ViewPatterns/PatternSynonyms

This commit is contained in:
2015-12-22 19:40:29 +01:00
parent 0b41fee237
commit eba0c95f8c
3 changed files with 27 additions and 39 deletions

View File

@@ -193,6 +193,16 @@ data FileInfo = FileInfo {
} deriving (Show, Eq, Ord)
isSymL :: AnchoredFile FileInfo FileInfo
-> (Bool, AnchoredFile FileInfo FileInfo)
isSymL f@(_ :/ Dir _ FileInfo { isSymbolicLink = True }) = (True, f)
isSymL f@(_ :/ RegFile _ FileInfo { isSymbolicLink = True }) = (True, f)
isSymL f = (False, f)
pattern IsSymL b <- (isSymL -> (b, f))
----------------------------