diff options
-rw-r--r-- | src/Hakyll/Core/Identifier/Pattern.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs index 52b998b..42f67f0 100644 --- a/src/Hakyll/Core/Identifier/Pattern.hs +++ b/src/Hakyll/Core/Identifier/Pattern.hs @@ -34,6 +34,7 @@ module Hakyll.Core.Identifier.Pattern ( Pattern , parseGlob + , predicate , matches , filterMatches , capture @@ -80,6 +81,15 @@ parseGlob = Glob . parse' ('*' : xs) -> Literal chunk : Capture : parse' xs xs -> Literal chunk : Literal xs : [] +-- | Create a 'Pattern' from an arbitrary predicate +-- +-- Example: +-- +-- > predicate (\i -> matches "foo/*" i && not (matches "foo/bar" i)) +-- +predicate :: (Identifier -> Bool) -> Pattern +predicate = Predicate + -- | Check if an identifier matches a pattern -- matches :: Pattern -> Identifier -> Bool |