stackage/patching/patches/criterion-0.8.0.1.patch
Michael Snoyman a7c52795ff Some patches
2014-03-06 15:05:28 +02:00

56 lines
1.7 KiB
Diff

diff -ru orig/Criterion/IO.hs new/Criterion/IO.hs
--- orig/Criterion/IO.hs 2014-02-21 06:51:14.286525542 +0200
+++ new/Criterion/IO.hs 2014-02-21 06:51:14.000000000 +0200
@@ -1,4 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE CPP #-}
-- |
-- Module : Criterion.IO
-- Copyright : (c) 2009, 2010 Bryan O'Sullivan
@@ -21,7 +22,11 @@
import Criterion.Types (ResultForest, ResultTree(..))
import Data.Binary (Binary(..), encode)
+#if MIN_VERSION_binary(0, 6, 3)
import Data.Binary.Get (runGetOrFail)
+#else
+import Data.Binary.Get (runGetState)
+#endif
import Data.Binary.Put (putByteString, putWord16be, runPut)
import Data.Version (Version(..))
import Paths_criterion (version)
@@ -56,6 +61,7 @@
writeResults :: FilePath -> ResultForest -> IO ()
writeResults path rs = withFile path WriteMode (flip hPutResults rs)
+#if MIN_VERSION_binary(0, 6, 3)
readAll :: Binary a => Handle -> IO [a]
readAll handle = do
let go bs
@@ -64,3 +70,13 @@
Left (_, _, err) -> fail err
Right (bs', _, a) -> (a:) `fmap` go bs'
go =<< L.hGetContents handle
+#else
+readAll :: Binary a => Handle -> IO [a]
+readAll handle = do
+ let go i bs
+ | L.null bs = return []
+ | otherwise =
+ let (a, bs', i') = runGetState get bs i
+ in (a:) `fmap` go i' bs'
+ go 0 =<< L.hGetContents handle
+#endif
diff -ru orig/criterion.cabal new/criterion.cabal
--- orig/criterion.cabal 2014-02-21 06:51:14.314525543 +0200
+++ new/criterion.cabal 2014-02-21 06:51:14.000000000 +0200
@@ -58,7 +58,7 @@
build-depends:
aeson >= 0.3.2.12,
base < 5,
- binary >= 0.6.3.0,
+ binary >= 0.5.1.0,
bytestring >= 0.9 && < 1.0,
containers,
deepseq >= 1.1.0.0,