From b9efc54e931bae76a3a2255bc07249210f2abc62 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 11 Apr 2011 18:10:45 +0200 Subject: Set and check identifier groups --- src/Hakyll/Core/Identifier.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Hakyll/Core/Identifier.hs b/src/Hakyll/Core/Identifier.hs index 5b205f1..1cb625f 100644 --- a/src/Hakyll/Core/Identifier.hs +++ b/src/Hakyll/Core/Identifier.hs @@ -25,6 +25,8 @@ module Hakyll.Core.Identifier ( Identifier (..) , parseIdentifier , toFilePath + , setGroup + , hasGroup ) where import Control.Arrow (second) @@ -73,3 +75,13 @@ parseIdentifier = Identifier Nothing -- toFilePath :: Identifier -> FilePath toFilePath = identifierPath + +-- | Set the identifier group for some identifier +-- +setGroup :: String -> Identifier -> Identifier +setGroup g (Identifier _ p) = Identifier (Just g) p + +-- | Check if an identifier belongs to a certain group +-- +hasGroup :: String -> Identifier -> Bool +hasGroup g (Identifier g' _) = Just g == g' -- cgit v1.2.3