@@ -142,9 +142,9 @@ import Hakyll.Core.Logger
142-- version of 'runCompilerJob' also stores the result
142-- version of 'runCompilerJob' also stores the result
144runCompiler :: Compiler () CompileRule -- ^ Compiler to run
144runCompiler :: Compiler () CompileRule -- ^ Compiler to run
145− -> Identifier -- ^ Target identifier
145+ -> Identifier () -- ^ Target identifier
146 -> ResourceProvider -- ^ Resource provider
146 -> ResourceProvider -- ^ Resource provider
147− -> [Identifier] -- ^ Universe
147+ -> [Identifier ()] -- ^ Universe
148 -> Routes -- ^ Route
148 -> Routes -- ^ Route
149 -> Store -- ^ Store
149 -> Store -- ^ Store
150 -> Bool -- ^ Was the resource modified?
150 -> Bool -- ^ Was the resource modified?
@@ -161,7 +161,8 @@ runCompiler compiler id' provider universe routes store modified logger = do
161 -- before we return control. This makes sure the compiled item can later
161 -- before we return control. This makes sure the compiled item can later
162 -- be accessed by e.g. require.
162 -- be accessed by e.g. require.
163 Right (CompileRule (CompiledItem x)) ->
163 Right (CompileRule (CompiledItem x)) ->
164− storeSet store "Hakyll.Core.Compiler.runCompiler" id' x
164+ storeSet store "Hakyll.Core.Compiler.runCompiler"
165+ (castIdentifier id') x
166 -- Otherwise, we do nothing here
167 -- Otherwise, we do nothing here
167 _ -> return ()
168 _ -> return ()
@@ -170,8 +171,9 @@ runCompiler compiler id' provider universe routes store modified logger = do
171-- | Get the identifier of the item that is currently being compiled
172-- | Get the identifier of the item that is currently being compiled
173−getIdentifier :: Compiler a Identifier
174+getIdentifier :: Compiler a (Identifier b)
174−getIdentifier = fromJob $ const $ CompilerM $ compilerIdentifier <$> ask
175+getIdentifier = fromJob $ const $ CompilerM $
176+ castIdentifier . compilerIdentifier <$> ask
176-- | Get the route we are using for this item
178-- | Get the route we are using for this item
@@ -180,7 +182,7 @@ getRoute = getIdentifier >>> getRouteFor
181-- | Get the route for a specified item
183-- | Get the route for a specified item
183−getRouteFor :: Compiler Identifier (Maybe FilePath)
185+getRouteFor :: Compiler (Identifier a) (Maybe FilePath)
184getRouteFor = fromJob $ \identifier -> CompilerM $ do
186getRouteFor = fromJob $ \identifier -> CompilerM $ do
185 routes <- compilerRoutes <$> ask
187 routes <- compilerRoutes <$> ask
186 return $ runRoutes routes identifier
188 return $ runRoutes routes identifier
@@ -212,7 +214,7 @@ getResourceWith reader = fromJob $ \resource -> CompilerM $ do
212-- | Auxiliary: get a dependency
214-- | Auxiliary: get a dependency
214getDependency :: (Binary a, Writable a, Typeable a)
216getDependency :: (Binary a, Writable a, Typeable a)
215− => Identifier -> CompilerM a
217+ => Identifier a -> CompilerM a
216getDependency id' = CompilerM $ do
218getDependency id' = CompilerM $ do
217 store <- compilerStore <$> ask
219 store <- compilerStore <$> ask
218 result <- liftIO $ storeGet store "Hakyll.Core.Compiler.runCompiler" id'
220 result <- liftIO $ storeGet store "Hakyll.Core.Compiler.runCompiler" id'
@@ -233,7 +235,7 @@ getDependency id' = CompilerM $ do
233-- | Variant of 'require' which drops the current value
235-- | Variant of 'require' which drops the current value
235require_ :: (Binary a, Typeable a, Writable a)
237require_ :: (Binary a, Typeable a, Writable a)
236− => Identifier
238+ => Identifier a
237 -> Compiler b a
239 -> Compiler b a
238require_ identifier =
240require_ identifier =
239 fromDependency identifier >>> fromJob (const $ getDependency identifier)
241 fromDependency identifier >>> fromJob (const $ getDependency identifier)
@@ -242,7 +244,7 @@ require_ identifier =
242-- dependencies
244-- dependencies
244require :: (Binary a, Typeable a, Writable a)
246require :: (Binary a, Typeable a, Writable a)
245− => Identifier
247+ => Identifier a
246 -> (b -> a -> c)
248 -> (b -> a -> c)
247 -> Compiler b c
249 -> Compiler b c
248require identifier = requireA identifier . arr . uncurry
250require identifier = requireA identifier . arr . uncurry
@@ -250,7 +252,7 @@ require identifier = requireA identifier . arr . uncurry
250-- | Arrow-based variant of 'require'
252-- | Arrow-based variant of 'require'
252requireA :: (Binary a, Typeable a, Writable a)
254requireA :: (Binary a, Typeable a, Writable a)
253− => Identifier
255+ => Identifier a
254 -> Compiler (b, a) c
256 -> Compiler (b, a) c
255 -> Compiler b c
257 -> Compiler b c
256requireA identifier = (id &&& require_ identifier >>>)
258requireA identifier = (id &&& require_ identifier >>>)
@@ -262,7 +264,7 @@ requireAll_ :: (Binary a, Typeable a, Writable a)
262 -> Compiler b [a]
264 -> Compiler b [a]
263requireAll_ pattern = fromDependencies (const getDeps) >>> fromJob requireAll_'
265requireAll_ pattern = fromDependencies (const getDeps) >>> fromJob requireAll_'
265− getDeps = filterMatches pattern
267+ getDeps = map castIdentifier . filterMatches pattern . map castIdentifier
266 requireAll_' = const $ CompilerM $ do
268 requireAll_' = const $ CompilerM $ do
267 deps <- getDeps . compilerUniverse <$> ask
269 deps <- getDeps . compilerUniverse <$> ask
268 mapM (unCompilerM . getDependency) deps
270 mapM (unCompilerM . getDependency) deps
@@ -290,7 +292,7 @@ cached :: (Binary a, Typeable a, Writable a)
290 -> Compiler Resource a
292 -> Compiler Resource a
291cached name (Compiler d j) = Compiler d $ const $ CompilerM $ do
293cached name (Compiler d j) = Compiler d $ const $ CompilerM $ do
292 logger <- compilerLogger <$> ask
294 logger <- compilerLogger <$> ask
293− identifier <- compilerIdentifier <$> ask
295+ identifier <- castIdentifier . compilerIdentifier <$> ask
294 store <- compilerStore <$> ask
296 store <- compilerStore <$> ask
295 modified <- compilerResourceModified <$> ask
297 modified <- compilerResourceModified <$> ask
296 report logger $ "Checking cache: " ++ if modified then "modified" else "OK"
298 report logger $ "Checking cache: " ++ if modified then "modified" else "OK"