summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Resource.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/Resource.hs')
-rw-r--r--src/Hakyll/Core/Resource.hs40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/Hakyll/Core/Resource.hs b/src/Hakyll/Core/Resource.hs
index 566bb26..0a43fc2 100644
--- a/src/Hakyll/Core/Resource.hs
+++ b/src/Hakyll/Core/Resource.hs
@@ -1,31 +1,51 @@
+--------------------------------------------------------------------------------
-- | Module exporting the simple 'Resource' type
---
module Hakyll.Core.Resource
- ( Resource
- , unResource
+ ( -- * Constructing and deconstructing resources
+ Resource
, resource
+ , unResource
+
+ -- * Conversions to and from identifiers
, fromIdentifier
, toIdentifier
+
+ -- * TODO: Move me
+ , Metadata
) where
-import Hakyll.Core.Identifier
+--------------------------------------------------------------------------------
+import Data.Map (Map)
+
+
+--------------------------------------------------------------------------------
+import Hakyll.Core.Identifier
+
+
+--------------------------------------------------------------------------------
-- | A resource
---
newtype Resource = Resource {unResource :: FilePath}
deriving (Eq, Show, Ord)
+
+--------------------------------------------------------------------------------
-- | Smart constructor to ensure we have @/@ as path separator
---
resource :: FilePath -> Resource
resource = fromIdentifier . parseIdentifier
--- | Create a resource from an identifier
---
+
+--------------------------------------------------------------------------------
+-- | Find the resource for an identifier
fromIdentifier :: Identifier a -> Resource
fromIdentifier = Resource . toFilePath
--- | Map the resource to an identifier. Note that the group will not be set!
---
+
+--------------------------------------------------------------------------------
+-- | Convert a resource to an identifier
toIdentifier :: Resource -> Identifier a
toIdentifier = parseIdentifier . unResource
+
+
+--------------------------------------------------------------------------------
+type Metadata = Map String String