From b7059a0f1a05db0b2e33efae935ece65f97ea3fc Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 5 Apr 2011 11:46:16 +0200 Subject: Add function to construct predicates --- src/Hakyll/Core/Identifier/Pattern.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 -- cgit v1.2.3