summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hakyll.cabal3
-rw-r--r--src/Text/Hakyll/Page.hs7
2 files changed, 7 insertions, 3 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index f1d0ad7..f5568d6 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -34,7 +34,8 @@ library
network >= 2,
mtl >= 1.1,
old-locale >= 1,
- time >= 1
+ time >= 1,
+ parallel >= 1
exposed-modules: Text.Hakyll
Text.Hakyll.Render
Text.Hakyll.Renderable
diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs
index f70d898..c5ddc3a 100644
--- a/src/Text/Hakyll/Page.hs
+++ b/src/Text/Hakyll/Page.hs
@@ -10,6 +10,8 @@ import qualified Data.Map as M
import qualified Data.List as L
import Data.Maybe (fromMaybe)
+import Control.Parallel.Strategies (rnf, ($|))
+
import System.FilePath (FilePath, takeExtension)
import System.IO
@@ -110,13 +112,14 @@ readPage pagePath = do
-- Render file
let rendered = (renderFunction $ takeExtension path) body
- seq rendered $ hClose handle
- let page = fromContext $ M.fromList $
+ page = fromContext $ M.fromList $
[ ("body", rendered)
, ("url", url)
, ("path", pagePath)
] ++ context
+ seq (($|) id rnf rendered) $ hClose handle
+
-- Cache if needed
if getFromCache then return () else cachePage page
return page