summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-03-30 11:31:14 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2013-03-30 11:31:14 +0100
commitbf496c2f55f61f53fdc0ef7a03db7dc098ae766d (patch)
tree899e991405cc8e74a9c54d01364fa1e293bb38e9
parent393a08594d3c98b9f47692890edbb31b1bf860c2 (diff)
downloadhakyll-bf496c2f55f61f53fdc0ef7a03db7dc098ae766d.tar.gz
We'll do it ourselves
-rw-r--r--hakyll.cabal4
-rw-r--r--src/Hakyll/Core/UnixFilter.hs17
2 files changed, 12 insertions, 9 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index d34aabc..4a555b9 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -139,7 +139,7 @@ Library
binary >= 0.5 && < 0.8,
blaze-html >= 0.5 && < 0.7,
blaze-markup >= 0.5.1 && < 0.6,
- bytestring >= 0.10 && < 0.11,
+ bytestring >= 0.9 && < 0.11,
citeproc-hs >= 0.3.2 && < 0.4,
containers >= 0.3 && < 0.6,
cryptohash >= 0.7 && < 0.9,
@@ -213,7 +213,7 @@ Test-suite hakyll-tests
binary >= 0.5 && < 0.8,
blaze-html >= 0.5 && < 0.7,
blaze-markup >= 0.5.1 && < 0.6,
- bytestring >= 0.10 && < 0.11,
+ bytestring >= 0.9 && < 0.11,
citeproc-hs >= 0.3.2 && < 0.4,
containers >= 0.3 && < 0.6,
cryptohash >= 0.7 && < 0.9,
diff --git a/src/Hakyll/Core/UnixFilter.hs b/src/Hakyll/Core/UnixFilter.hs
index 6824bd8..1544bf2 100644
--- a/src/Hakyll/Core/UnixFilter.hs
+++ b/src/Hakyll/Core/UnixFilter.hs
@@ -9,7 +9,7 @@ module Hakyll.Core.UnixFilter
--------------------------------------------------------------------------------
import Control.Concurrent (forkIO)
import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar)
-import Control.DeepSeq (NFData, deepseq)
+import Control.DeepSeq (deepseq)
import Control.Monad (forM_)
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as LB
@@ -57,7 +57,8 @@ unixFilter = unixFilterWith writer reader
hPutStr handle input
reader handle = do
hSetEncoding handle localeEncoding
- hGetContents handle
+ out <- hGetContents handle
+ deepseq out (return out)
--------------------------------------------------------------------------------
@@ -70,12 +71,14 @@ unixFilterLBS :: String -- ^ Program name
-> [String] -- ^ Program args
-> ByteString -- ^ Program input
-> Compiler ByteString -- ^ Program output
-unixFilterLBS = unixFilterWith LB.hPutStr LB.hGetContents
+unixFilterLBS = unixFilterWith LB.hPutStr $ \handle -> do
+ out <- LB.hGetContents handle
+ LB.length out `seq` return out
--------------------------------------------------------------------------------
-- | Overloaded compiler
-unixFilterWith :: (Monoid o, NFData o)
+unixFilterWith :: Monoid o
=> (Handle -> i -> IO ()) -- ^ Writer
-> (Handle -> IO o) -- ^ Reader
-> String -- ^ Program name
@@ -96,7 +99,7 @@ unixFilterWith writer reader programName args input = do
--------------------------------------------------------------------------------
-- | Internally used function
-unixFilterIO :: (Monoid o, NFData o)
+unixFilterIO :: Monoid o
=> (Handle -> i -> IO ())
-> (Handle -> IO o)
-> String
@@ -122,14 +125,14 @@ unixFilterIO writer reader programName args input = do
-- Read from stdout
_ <- forkIO $ do
out <- reader outh
- deepseq out (hClose outh)
+ hClose outh
writeIORef outRef out
putMVar lock ()
-- Read from stderr
_ <- forkIO $ do
err <- hGetContents errh
- deepseq err (hClose errh)
+ hClose errh
writeIORef errRef err
putMVar lock ()