on master help sign in
Strictness cleanup.
commitd7f04a2c6d036363a6257f32409e86fb6112f6ac authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSat 23 Jan 2010, 10:25 (17 years ago) parentaaa7771
4 files changed+7−11
hakyll.cabal+1−1 src/Text/Hakyll/Page.hs+3−7 src/Text/Hakyll/Render/Internal.hs+2−2 tests/Tests.hs+1−1
hakyll.cabal+1−1
@@ -34,7 +34,7 @@ library
3434 mtl >= 1.1,
3535 old-locale >= 1,
3636 time >= 1,
37− parallel >= 2,
37+ deepseq >= 1,
3838 binary >= 0.5
3939 exposed-modules: Text.Hakyll
4040 Text.Hakyll.Hakyll
src/Text/Hakyll/Page.hs+3−7
@@ -13,7 +13,6 @@ import Data.Char (isSpace)
1313import Data.Maybe (fromMaybe)
1414import Control.Monad (liftM)
1515import Control.Monad.Reader (liftIO)
16−import Control.Parallel.Strategies (rdeepseq, ($|))
1716import System.FilePath (takeExtension)
1817import System.IO
1918
@@ -121,17 +120,14 @@ readPageFromFile path = do
121120 (True : repeat False)
122121
123122 -- Read file.
124− handle <- liftIO $ openFile path ReadMode
125− sections <- fmap (splitAtDelimiters . lines )
126− (liftIO $ hGetContents handle)
127−
128− let context = concat $ zipWith ($) sectionFunctions sections
123+ contents <- liftIO $ readFile path
124+ let sections = splitAtDelimiters $ lines $ contents
125+ context = concat $ zipWith ($) sectionFunctions sections
129126 page = fromContext $ M.fromList $
130127 [ ("url", url)
131128 , ("path", path)
132129 ] ++ context
133130
134− seq (($|) id rdeepseq context) $ liftIO $ hClose handle
135131 return page
136132 where
137133 url = toURL path
src/Text/Hakyll/Render/Internal.hs+2−2
@@ -11,11 +11,11 @@ module Text.Hakyll.Render.Internal
1111
1212import qualified Data.Map as M
1313import Text.Hakyll.Context (Context, ContextManipulation)
14+import Control.DeepSeq (deepseq)
1415import Control.Monad.Reader (liftIO)
1516import Data.List (isPrefixOf, foldl')
1617import Data.Char (isAlphaNum)
1718import Data.Maybe (fromMaybe)
18−import Control.Parallel.Strategies (rdeepseq, ($|))
1919
2020import Text.Hakyll.Renderable
2121import Text.Hakyll.Page
@@ -57,7 +57,7 @@ pureRenderWith manipulation template context =
5757 let contextIgnoringRoot = M.insert "root" "$root" (manipulation context)
5858 body = regularSubstitute template contextIgnoringRoot
5959 -- Force the body to be rendered.
60− in ($|) id rdeepseq (M.insert "body" body context)
60+ in body `deepseq` M.insert "body" body context
6161
6262-- | A pure renderAndConcat function.
6363pureRenderAndConcatWith :: ContextManipulation
tests/Tests.hs+1−1
@@ -45,7 +45,7 @@ tests = [ testGroup "Util group"
4545 ]
4646
4747 , testGroup "File group"
48− , testCase "toRoot 1" test_to_root1
48+ [ testCase "toRoot 1" test_to_root1
4949 , testCase "toRoot 2" test_to_root2
5050 , testCase "toRoot 3" test_to_root3
5151 , testCase "removeSpaces 1" test_remove_spaces1