summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-11 18:10:45 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-04-11 18:10:45 +0200
commitb9efc54e931bae76a3a2255bc07249210f2abc62 (patch)
tree31eda60b95f9529b09aa47909b8889adc55c3bf1
parent15045d313c9d23014fcf284625a90d67d3a10d4d (diff)
downloadhakyll-b9efc54e931bae76a3a2255bc07249210f2abc62.tar.gz
Set and check identifier groups
-rw-r--r--src/Hakyll/Core/Identifier.hs12
1 files changed, 12 insertions, 0 deletions
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'