diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-11 23:26:54 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-11 23:26:54 +0100 |
commit | 34257df262521e4031c5e19acad3e9ce060c488b (patch) | |
tree | 9316ed7bf401bc0a75b5a832890aca0f213cea06 /src/Hakyll/Core/Compiler.hs | |
parent | 2b9858a8f9212219718625b7c5891bcb11cbaefb (diff) | |
download | hakyll-34257df262521e4031c5e19acad3e9ce060c488b.tar.gz |
Resource = Identifier with an exists invariant
Diffstat (limited to 'src/Hakyll/Core/Compiler.hs')
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index bbb5737..056ef32 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -88,11 +88,9 @@ getRouteFor = fromJob $ \identifier -> CompilerM $ do -- | Get the resource we are compiling as a string -- getResourceString :: Compiler Resource String -getResourceString = getIdentifier >>> getResourceString' - where - getResourceString' = fromJob $ \id' -> CompilerM $ do - provider <- compilerResourceProvider <$> ask - liftIO $ resourceString provider id' +getResourceString = fromJob $ \resource -> CompilerM $ do + provider <- compilerResourceProvider <$> ask + liftIO $ resourceString provider resource -- | Auxiliary: get a dependency -- @@ -141,7 +139,7 @@ requireAll_ :: (Binary a, Typeable a, Writable a) -> Compiler b [a] requireAll_ pattern = fromDependencies getDeps >>> fromJob requireAll_' where - getDeps = matches pattern . resourceList + getDeps = matches pattern . map unResource . resourceList requireAll_' = const $ CompilerM $ do deps <- getDeps . compilerResourceProvider <$> ask mapM (unCompilerM . getDependency) deps @@ -174,7 +172,7 @@ cached name (Compiler d j) = Compiler d $ const $ CompilerM $ do liftIO $ putStrLn $ show identifier ++ ": " ++ if modified then "MODIFIED" else "OK" if modified - then do v <- unCompilerM $ j Resource + then do v <- unCompilerM $ j $ Resource identifier liftIO $ storeSet store name identifier v return v else do v <- liftIO $ storeGet store name identifier |