diff options
Diffstat (limited to 'src/Hakyll/Core/Identifier')
-rw-r--r-- | src/Hakyll/Core/Identifier/Pattern.hs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs index e770d13..5f97215 100644 --- a/src/Hakyll/Core/Identifier/Pattern.hs +++ b/src/Hakyll/Core/Identifier/Pattern.hs @@ -36,13 +36,19 @@ -- function. -- module Hakyll.Core.Identifier.Pattern - ( Pattern + ( -- * The pattern type + Pattern , castPattern + + -- * Creating patterns , parseGlob , predicate , list , regex , inGroup + , complement + + -- * Applying patterns , matches , filterMatches , capture @@ -131,6 +137,15 @@ regex str = predicate $ fromMaybe False . (=~~ str) . toFilePath inGroup :: Maybe String -> Pattern a inGroup group = predicate $ (== group) . identifierGroup +-- | Inverts a pattern, e.g. +-- +-- > complement "foo/bar.html" +-- +-- will match /anything/ except @\"foo\/bar.html\"@ +-- +complement :: Pattern a -> Pattern a +complement p = predicate (not . matches p) + -- | Check if an identifier matches a pattern -- matches :: Pattern a -> Identifier a -> Bool |