diff options
-rw-r--r-- | hakyll.cabal | 2 | ||||
-rw-r--r-- | src/Text/Hakyll/Page.hs | 10 | ||||
-rw-r--r-- | src/Text/Hakyll/Render/Internal.hs | 4 | ||||
-rw-r--r-- | tests/Tests.hs | 2 |
4 files changed, 7 insertions, 11 deletions
diff --git a/hakyll.cabal b/hakyll.cabal index 7a3ca2a..ddbf65e 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -34,7 +34,7 @@ library mtl >= 1.1, old-locale >= 1, time >= 1, - parallel >= 2, + deepseq >= 1, binary >= 0.5 exposed-modules: Text.Hakyll Text.Hakyll.Hakyll diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs index 6ead0ae..9c319ba 100644 --- a/src/Text/Hakyll/Page.hs +++ b/src/Text/Hakyll/Page.hs @@ -13,7 +13,6 @@ import Data.Char (isSpace) import Data.Maybe (fromMaybe) import Control.Monad (liftM) import Control.Monad.Reader (liftIO) -import Control.Parallel.Strategies (rdeepseq, ($|)) import System.FilePath (takeExtension) import System.IO @@ -121,17 +120,14 @@ readPageFromFile path = do (True : repeat False) -- Read file. - handle <- liftIO $ openFile path ReadMode - sections <- fmap (splitAtDelimiters . lines ) - (liftIO $ hGetContents handle) - - let context = concat $ zipWith ($) sectionFunctions sections + contents <- liftIO $ readFile path + let sections = splitAtDelimiters $ lines $ contents + context = concat $ zipWith ($) sectionFunctions sections page = fromContext $ M.fromList $ [ ("url", url) , ("path", path) ] ++ context - seq (($|) id rdeepseq context) $ liftIO $ hClose handle return page where url = toURL path diff --git a/src/Text/Hakyll/Render/Internal.hs b/src/Text/Hakyll/Render/Internal.hs index 51eecc7..27459ad 100644 --- a/src/Text/Hakyll/Render/Internal.hs +++ b/src/Text/Hakyll/Render/Internal.hs @@ -11,11 +11,11 @@ module Text.Hakyll.Render.Internal import qualified Data.Map as M import Text.Hakyll.Context (Context, ContextManipulation) +import Control.DeepSeq (deepseq) import Control.Monad.Reader (liftIO) import Data.List (isPrefixOf, foldl') import Data.Char (isAlphaNum) import Data.Maybe (fromMaybe) -import Control.Parallel.Strategies (rdeepseq, ($|)) import Text.Hakyll.Renderable import Text.Hakyll.Page @@ -57,7 +57,7 @@ pureRenderWith manipulation template context = let contextIgnoringRoot = M.insert "root" "$root" (manipulation context) body = regularSubstitute template contextIgnoringRoot -- Force the body to be rendered. - in ($|) id rdeepseq (M.insert "body" body context) + in body `deepseq` M.insert "body" body context -- | A pure renderAndConcat function. pureRenderAndConcatWith :: ContextManipulation diff --git a/tests/Tests.hs b/tests/Tests.hs index 5e449f2..6602426 100644 --- a/tests/Tests.hs +++ b/tests/Tests.hs @@ -45,7 +45,7 @@ tests = [ testGroup "Util group" ] , testGroup "File group" - , testCase "toRoot 1" test_to_root1 + [ testCase "toRoot 1" test_to_root1 , testCase "toRoot 2" test_to_root2 , testCase "toRoot 3" test_to_root3 , testCase "removeSpaces 1" test_remove_spaces1 |