diff options
-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 |