summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Compiler/Internal.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-24 11:58:13 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-24 11:58:13 +0200
commit758e0beaaa2f9f97bb22fa4067d75efda4dbd31b (patch)
tree5f783f2652628f2d3c70a2e868e79145ff469a32 /src/Hakyll/Core/Compiler/Internal.hs
parent41b7f3713889e8c5b4a21a85d8a2fcebf0b59054 (diff)
downloadhakyll-758e0beaaa2f9f97bb22fa4067d75efda4dbd31b.tar.gz
Type-safe identifiers
Diffstat (limited to 'src/Hakyll/Core/Compiler/Internal.hs')
-rw-r--r--src/Hakyll/Core/Compiler/Internal.hs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Hakyll/Core/Compiler/Internal.hs b/src/Hakyll/Core/Compiler/Internal.hs
index 594c23e..8ed822d 100644
--- a/src/Hakyll/Core/Compiler/Internal.hs
+++ b/src/Hakyll/Core/Compiler/Internal.hs
@@ -33,26 +33,26 @@ import Hakyll.Core.Logger
-- | A set of dependencies
--
-type Dependencies = Set Identifier
+type Dependencies = Set (Identifier ())
-- | Environment in which the dependency analyzer runs
--
data DependencyEnvironment = DependencyEnvironment
{ -- | Target identifier
- dependencyIdentifier :: Identifier
+ dependencyIdentifier :: Identifier ()
, -- | List of available identifiers we can depend upon
- dependencyUniverse :: [Identifier]
+ dependencyUniverse :: [Identifier ()]
}
-- | Environment in which a compiler runs
--
data CompilerEnvironment = CompilerEnvironment
{ -- | Target identifier
- compilerIdentifier :: Identifier
+ compilerIdentifier :: Identifier ()
, -- | Resource provider
compilerResourceProvider :: ResourceProvider
, -- | List of all known identifiers
- compilerUniverse :: [Identifier]
+ compilerUniverse :: [Identifier ()]
, -- | Site routes
compilerRoutes :: Routes
, -- | Compiler store
@@ -107,9 +107,9 @@ instance ArrowChoice Compiler where
-- | Run a compiler, yielding the resulting target
--
runCompilerJob :: Compiler () a -- ^ Compiler to run
- -> Identifier -- ^ Target identifier
+ -> Identifier () -- ^ Target identifier
-> ResourceProvider -- ^ Resource provider
- -> [Identifier] -- ^ Universe
+ -> [Identifier ()] -- ^ Universe
-> Routes -- ^ Route
-> Store -- ^ Store
-> Bool -- ^ Was the resource modified?
@@ -129,8 +129,8 @@ runCompilerJob compiler id' provider universe route store modified logger =
}
runCompilerDependencies :: Compiler () a
- -> Identifier
- -> [Identifier]
+ -> Identifier ()
+ -> [Identifier ()]
-> Dependencies
runCompilerDependencies compiler identifier universe =
runReader (compilerDependencies compiler) env
@@ -144,7 +144,7 @@ fromJob :: (a -> CompilerM b)
-> Compiler a b
fromJob = Compiler (return S.empty)
-fromDependencies :: (Identifier -> [Identifier] -> [Identifier])
+fromDependencies :: (Identifier () -> [Identifier ()] -> [Identifier ()])
-> Compiler b b
fromDependencies collectDeps = flip Compiler return $ do
DependencyEnvironment identifier universe <- ask
@@ -152,5 +152,5 @@ fromDependencies collectDeps = flip Compiler return $ do
-- | Wait until another compiler has finished before running this compiler
--
-fromDependency :: Identifier -> Compiler a a
-fromDependency = fromDependencies . const . const . return
+fromDependency :: Identifier a -> Compiler b b
+fromDependency = fromDependencies . const . const . return . castIdentifier