diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-30 09:50:02 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-30 09:50:02 +0100 |
commit | a20bc7bed9fd03e930297467f876c27f0072d1de (patch) | |
tree | d8086281527165f87939c83c3ea66cff2908d607 | |
parent | 010b3bc60449b47b4347f4ae3277e4277d9e8bde (diff) | |
download | hakyll-a20bc7bed9fd03e930297467f876c27f0072d1de.tar.gz |
Make saveSnapshot chainable
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 5 | ||||
-rw-r--r-- | tests/Hakyll/Core/Runtime/Tests.hs | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index 9fec69b..16364c9 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -109,11 +109,14 @@ getResourceWith reader = do -------------------------------------------------------------------------------- +-- | Save a snapshot of the item. This function returns the same item, which +-- convenient for building '>>=' chains. saveSnapshot :: (Binary a, Typeable a) - => Internal.Snapshot -> Item a -> Compiler () + => Internal.Snapshot -> Item a -> Compiler (Item a) saveSnapshot snapshot item = do store <- compilerStore <$> compilerAsk compilerUnsafeIO $ Internal.saveSnapshot store snapshot item + return item -------------------------------------------------------------------------------- diff --git a/tests/Hakyll/Core/Runtime/Tests.hs b/tests/Hakyll/Core/Runtime/Tests.hs index 3488dba..af85f4f 100644 --- a/tests/Hakyll/Core/Runtime/Tests.hs +++ b/tests/Hakyll/Core/Runtime/Tests.hs @@ -29,9 +29,9 @@ case01 = withTestConfiguration $ \config -> do match "*.md" $ do route $ setExtension "html" compile $ do - body <- getResourceBody - saveSnapshot "raw" body - return $ renderPandoc body + getResourceBody + >>= saveSnapshot "raw" + >>= return . renderPandoc match "bodies.txt" $ do route idRoute |