diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-04-05 11:46:16 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-04-05 11:46:16 +0200 |
commit | b7059a0f1a05db0b2e33efae935ece65f97ea3fc (patch) | |
tree | 2b0bce5cbbf5395c9b743a9d045575b17299b8b3 /src/Hakyll/Core/Identifier | |
parent | 091014a60e29700017c8d77b7561f37ae4a611be (diff) | |
download | hakyll-b7059a0f1a05db0b2e33efae935ece65f97ea3fc.tar.gz |
Add function to construct predicates
Diffstat (limited to 'src/Hakyll/Core/Identifier')
-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 |