summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Resource.hs
blob: 81547522b36019d076e085e9f35431dff5cc19e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- | Module exporting the simple 'Resource' type
--
module Hakyll.Core.Resource
    ( Resource (..)
    , fromIdentifier
    , toIdentifier
    ) where

import Hakyll.Core.Identifier

-- | A resource
--
newtype Resource = Resource {unResource :: String}
                 deriving (Eq, Show, Ord)

-- | Create a resource from an identifier
--
fromIdentifier :: Identifier -> Resource
fromIdentifier = Resource . toFilePath

-- | Map the resource to an identifier. Note that the group will not be set!
--
toIdentifier :: Resource -> Identifier
toIdentifier = parseIdentifier . unResource