diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-04-05 22:14:49 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-04-05 22:14:49 +0200 |
commit | 015663657ceca7b168bf7d91fbc2fccc41c40904 (patch) | |
tree | c015978d1eec85981a33d261e32d99d4242acff3 /src/Hakyll/Core | |
parent | 433f36e6f3efdf95276fe0a5f486db3be2824445 (diff) | |
download | hakyll-015663657ceca7b168bf7d91fbc2fccc41c40904.tar.gz |
New resource module hierarchy
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 11 | ||||
-rw-r--r-- | src/Hakyll/Core/Compiler/Internal.hs | 2 | ||||
-rw-r--r-- | src/Hakyll/Core/Resource.hs | 14 | ||||
-rw-r--r-- | src/Hakyll/Core/Resource/Provider.hs (renamed from src/Hakyll/Core/ResourceProvider.hs) | 13 | ||||
-rw-r--r-- | src/Hakyll/Core/Resource/Provider/File.hs (renamed from src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs) | 5 | ||||
-rw-r--r-- | src/Hakyll/Core/Rules.hs | 3 | ||||
-rw-r--r-- | src/Hakyll/Core/Rules/Internal.hs | 3 | ||||
-rw-r--r-- | src/Hakyll/Core/Run.hs | 5 | ||||
-rw-r--r-- | src/Hakyll/Core/Writable/CopyFile.hs | 2 |
9 files changed, 31 insertions, 27 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index 7fe1754..db51131 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -89,7 +89,6 @@ module Hakyll.Core.Compiler ( Compiler , runCompiler , getIdentifier - , getIdentifiers , getRoute , getRouteFor , getResourceString @@ -125,7 +124,8 @@ import Hakyll.Core.Identifier import Hakyll.Core.Identifier.Pattern import Hakyll.Core.CompiledItem import Hakyll.Core.Writable -import Hakyll.Core.ResourceProvider +import Hakyll.Core.Resource +import Hakyll.Core.Resource.Provider import Hakyll.Core.Compiler.Internal import Hakyll.Core.Store import Hakyll.Core.Rules.Internal @@ -166,13 +166,6 @@ runCompiler compiler identifier provider routes store modified logger = do getIdentifier :: Compiler a Identifier getIdentifier = fromJob $ const $ CompilerM $ compilerIdentifier <$> ask --- | Get all identifiers matching the given pattern --- -getIdentifiers :: Pattern -> Compiler a [Identifier] -getIdentifiers pattern = fromJob $ const $ CompilerM $ - matches pattern . map unResource . resourceList - . compilerResourceProvider <$> ask - -- | Get the route we are using for this item -- getRoute :: Compiler a (Maybe FilePath) diff --git a/src/Hakyll/Core/Compiler/Internal.hs b/src/Hakyll/Core/Compiler/Internal.hs index 4eef91c..1a3c4c3 100644 --- a/src/Hakyll/Core/Compiler/Internal.hs +++ b/src/Hakyll/Core/Compiler/Internal.hs @@ -26,7 +26,7 @@ import Control.Category (Category, (.), id) import Control.Arrow (Arrow, ArrowChoice, arr, first, left) import Hakyll.Core.Identifier -import Hakyll.Core.ResourceProvider +import Hakyll.Core.Resource.Provider import Hakyll.Core.Store import Hakyll.Core.Routes import Hakyll.Core.Logger diff --git a/src/Hakyll/Core/Resource.hs b/src/Hakyll/Core/Resource.hs new file mode 100644 index 0000000..d60fda9 --- /dev/null +++ b/src/Hakyll/Core/Resource.hs @@ -0,0 +1,14 @@ +-- | Module exporting the simple 'Resource' type +-- +module Hakyll.Core.Resource + ( Resource (..) + ) where + +import Hakyll.Core.Identifier + +-- | A resource +-- +-- Invariant: the resource specified by the given identifier must exist +-- +newtype Resource = Resource {unResource :: Identifier} + deriving (Eq, Show, Ord) diff --git a/src/Hakyll/Core/ResourceProvider.hs b/src/Hakyll/Core/Resource/Provider.hs index dcd4af0..377b029 100644 --- a/src/Hakyll/Core/ResourceProvider.hs +++ b/src/Hakyll/Core/Resource/Provider.hs @@ -10,9 +10,8 @@ -- Therefore, it is not recommended to read files directly -- you should use the -- provided 'Resource' methods. -- -module Hakyll.Core.ResourceProvider - ( Resource (..) - , ResourceProvider (..) +module Hakyll.Core.Resource.Provider + ( ResourceProvider (..) , resourceExists , resourceDigest , resourceModified @@ -27,13 +26,7 @@ import OpenSSL.Digest (MessageDigest (MD5)) import Hakyll.Core.Identifier import Hakyll.Core.Store - --- | A resource --- --- Invariant: the resource specified by the given identifier must exist --- -newtype Resource = Resource {unResource :: Identifier} - deriving (Eq, Show, Ord) +import Hakyll.Core.Resource -- | A value responsible for retrieving and listing resources -- diff --git a/src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs b/src/Hakyll/Core/Resource/Provider/File.hs index 0d89b21..a795fac 100644 --- a/src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs +++ b/src/Hakyll/Core/Resource/Provider/File.hs @@ -1,6 +1,6 @@ -- | A concrete 'ResourceProvider' that gets it's resources from the filesystem -- -module Hakyll.Core.ResourceProvider.FileResourceProvider +module Hakyll.Core.Resource.Provider.File ( fileResourceProvider ) where @@ -8,7 +8,8 @@ import Control.Applicative ((<$>)) import qualified Data.ByteString.Lazy as LB -import Hakyll.Core.ResourceProvider +import Hakyll.Core.Resource +import Hakyll.Core.Resource.Provider import Hakyll.Core.Identifier import Hakyll.Core.Util.File import Hakyll.Core.Configuration diff --git a/src/Hakyll/Core/Rules.hs b/src/Hakyll/Core/Rules.hs index 19df85e..892cf7c 100644 --- a/src/Hakyll/Core/Rules.hs +++ b/src/Hakyll/Core/Rules.hs @@ -37,7 +37,8 @@ import qualified Data.Set as S import Data.Typeable (Typeable) import Data.Binary (Binary) -import Hakyll.Core.ResourceProvider +import Hakyll.Core.Resource +import Hakyll.Core.Resource.Provider import Hakyll.Core.Identifier import Hakyll.Core.Identifier.Pattern import Hakyll.Core.Compiler.Internal diff --git a/src/Hakyll/Core/Rules/Internal.hs b/src/Hakyll/Core/Rules/Internal.hs index 592194d..0e117ec 100644 --- a/src/Hakyll/Core/Rules/Internal.hs +++ b/src/Hakyll/Core/Rules/Internal.hs @@ -18,7 +18,8 @@ import Control.Monad.State (State, evalState) import Data.Monoid (Monoid, mempty, mappend) import Data.Set (Set) -import Hakyll.Core.ResourceProvider +import Hakyll.Core.Resource +import Hakyll.Core.Resource.Provider import Hakyll.Core.Identifier import Hakyll.Core.Identifier.Pattern import Hakyll.Core.Compiler.Internal diff --git a/src/Hakyll/Core/Run.hs b/src/Hakyll/Core/Run.hs index 9a5245d..8e1ba6d 100644 --- a/src/Hakyll/Core/Run.hs +++ b/src/Hakyll/Core/Run.hs @@ -23,8 +23,9 @@ import Hakyll.Core.Identifier import Hakyll.Core.Util.File import Hakyll.Core.Compiler import Hakyll.Core.Compiler.Internal -import Hakyll.Core.ResourceProvider -import Hakyll.Core.ResourceProvider.FileResourceProvider +import Hakyll.Core.Resource +import Hakyll.Core.Resource.Provider +import Hakyll.Core.Resource.Provider.File import Hakyll.Core.Rules.Internal import Hakyll.Core.DirectedGraph import Hakyll.Core.DirectedGraph.DependencySolver diff --git a/src/Hakyll/Core/Writable/CopyFile.hs b/src/Hakyll/Core/Writable/CopyFile.hs index 1cd5fd2..ab9c698 100644 --- a/src/Hakyll/Core/Writable/CopyFile.hs +++ b/src/Hakyll/Core/Writable/CopyFile.hs @@ -12,7 +12,7 @@ import System.Directory (copyFile) import Data.Typeable (Typeable) import Data.Binary (Binary) -import Hakyll.Core.ResourceProvider +import Hakyll.Core.Resource import Hakyll.Core.Writable import Hakyll.Core.Compiler import Hakyll.Core.Identifier |