on master help sign in
Set and check identifier groups
commitb9efc54e931bae76a3a2255bc07249210f2abc62 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateMon 11 Apr 2011, 18:10 (16 years ago) parent15045d3
1 file changed+12
src/Hakyll/Core/Identifier.hs+12
src/Hakyll/Core/Identifier.hs+12
@@ -25,6 +25,8 @@ module Hakyll.Core.Identifier
2525 ( Identifier (..)
2626 , parseIdentifier
2727 , toFilePath
28+ , setGroup
29+ , hasGroup
2830 ) where
2931
3032import Control.Arrow (second)
@@ -73,3 +75,13 @@ parseIdentifier = Identifier Nothing
7375--
7476toFilePath :: Identifier -> FilePath
7577toFilePath = identifierPath
78+
79+-- | Set the identifier group for some identifier
80+--
81+setGroup :: String -> Identifier -> Identifier
82+setGroup g (Identifier _ p) = Identifier (Just g) p
83+
84+-- | Check if an identifier belongs to a certain group
85+--
86+hasGroup :: String -> Identifier -> Bool
87+hasGroup g (Identifier g' _) = Just g == g'