From bc192a127b8c57ccb45ff6c773f5917fdbf7ec85 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sat, 24 Nov 2012 10:24:54 +0100 Subject: Small fixes --- src/Hakyll/Core/Identifier/Pattern.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Hakyll/Core/Identifier') diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs index 48e5441..eb9da374 100644 --- a/src/Hakyll/Core/Identifier/Pattern.hs +++ b/src/Hakyll/Core/Identifier/Pattern.hs @@ -68,6 +68,8 @@ import Data.Binary (Binary (..), getWord8, putWord8) import Data.List (inits, isPrefixOf, tails) import Data.Maybe (isJust) import Data.Monoid (Monoid, mappend, mempty) +import Data.Set (Set) +import qualified Data.Set as S -------------------------------------------------------------------------------- @@ -108,7 +110,7 @@ data Pattern | Complement Pattern | And Pattern Pattern | Glob [GlobComponent] - | List [Identifier] -- TODO Maybe use a set here + | List (Set Identifier) | Regex String | Version (Maybe String) deriving (Show) @@ -162,7 +164,7 @@ fromGlob = Glob . parse' -------------------------------------------------------------------------------- -- | Create a 'Pattern' from a list of 'Identifier's it should match fromList :: [Identifier] -> Pattern -fromList = List +fromList = List . S.fromList -------------------------------------------------------------------------------- @@ -205,7 +207,7 @@ matches Everything _ = True matches (Complement p) i = not $ matches p i matches (And x y) i = matches x i && matches y i matches (Glob p) i = isJust $ capture (Glob p) i -matches (List l) i = i `elem` l +matches (List l) i = i `S.member` l matches (Regex r) i = toFilePath i =~ r matches (Version v) i = identifierVersion i == v -- cgit v1.2.3