1diff -ru orig/Criterion/Analysis/Types.hs new/Criterion/Analysis/Types.hs
2--- orig/Criterion/Analysis/Types.hs 2014-04-10 08:02:35.383848688 +0300
3+++ new/Criterion/Analysis/Types.hs 2014-04-10 08:02:34.000000000 +0300
8+import Control.Applicative ((<$>), (<*>))
9 import Control.DeepSeq (NFData(rnf))
10-import Data.Binary (Binary)
11+import Data.Binary (Binary, put, get)
12 import Data.Data (Data, Typeable)
13 import Data.Int (Int64)
14+import Data.Word (Word8)
15 import Data.Monoid (Monoid(..))
16 import GHC.Generics (Generic)
17 import qualified Statistics.Resampling.Bootstrap as B
19 -- ^ More than 3 times the IQR above the third quartile.
20 } deriving (Eq, Read, Show, Typeable, Data, Generic)
22-instance Binary Outliers
23+instance Binary Outliers where
24+ put (Outliers a b c d e) = do
30+ get = Outliers <$> get <*> get <*> get <*> get <*> get
31 instance NFData Outliers
33 -- | A description of the extent to which outliers in the sample data
36 deriving (Eq, Ord, Read, Show, Typeable, Data, Generic)
38-instance Binary OutlierEffect
39+instance Binary OutlierEffect where
40+ put Unaffected = put (0 :: Word8)
41+ put Slight = put (1 :: Word8)
42+ put Moderate = put (2 :: Word8)
43+ put Severe = put (3 :: Word8)
47+ 0 -> return Unaffected
51+ _ -> error "Binary.get for OutlierEffect failed"
52 instance NFData OutlierEffect
54 instance Monoid Outliers where
56 -- ^ Quantitative description of effect (a fraction between 0 and 1).
57 } deriving (Eq, Read, Show, Typeable, Data, Generic)
59-instance Binary OutlierVariance
60+instance Binary OutlierVariance where
61+ put (OutlierVariance a b c) = put a >> put b >> put c
62+ get = OutlierVariance <$> get <*> get <*> get
64 instance NFData OutlierVariance where
65 rnf OutlierVariance{..} = rnf ovEffect `seq` rnf ovDesc `seq` rnf ovFraction
67 , anOutlierVar :: OutlierVariance
68 } deriving (Eq, Read, Show, Typeable, Data, Generic)
70-instance Binary SampleAnalysis
71+instance Binary SampleAnalysis where
72+ put (SampleAnalysis a b c) = put a >> put b >> put c
73+ get = SampleAnalysis <$> get <*> get <*> get
75 instance NFData SampleAnalysis where
76 rnf SampleAnalysis{..} =
77diff -ru orig/Criterion/IO.hs new/Criterion/IO.hs
78--- orig/Criterion/IO.hs 2014-04-10 08:02:35.383848688 +0300
79+++ new/Criterion/IO.hs 2014-04-10 08:02:34.000000000 +0300
82 {-# LANGUAGE OverloadedStrings #-}
84 -- Module : Criterion.IO
87 import Criterion.Types (ResultForest, ResultTree(..))
88 import Data.Binary (Binary(..), encode)
89+#if MIN_VERSION_binary(0,6,3)
90 import Data.Binary.Get (runGetOrFail)
92+import Data.Binary.Get (runGetState)
94 import Data.Binary.Put (putByteString, putWord16be, runPut)
95 import Data.ByteString.Char8 ()
96 import Data.Version (Version(..))
98 writeResults path rs = withFile path WriteMode (flip hPutResults rs)
100 readAll :: Binary a => Handle -> IO [a]
101+#if MIN_VERSION_binary(0,6,3)
104 | L.null bs = return []
106 Left (_, _, err) -> fail err
107 Right (bs', _, a) -> (a:) `fmap` go bs'
108 go =<< L.hGetContents handle
112+ | L.null bs = return []
114+ let (a, bs', i') = runGetState get bs i
115+ in (a:) `fmap` go i' bs'
116+ go 0 =<< L.hGetContents handle
118diff -ru orig/Criterion/Types.hs new/Criterion/Types.hs
119--- orig/Criterion/Types.hs 2014-04-10 08:02:35.383848688 +0300
120+++ new/Criterion/Types.hs 2014-04-10 08:02:34.000000000 +0300
125+import Control.Applicative ((<$>), (<*>))
126 import Control.DeepSeq (NFData, rnf)
127 import Control.Exception (evaluate)
128 import Criterion.Analysis.Types (Outliers(..), SampleAnalysis(..))
129-import Data.Binary (Binary)
130+import Data.Binary (Binary (get, put))
131 import Data.Data (Data, Typeable)
132+import Data.Word (Word8)
133 import GHC.Generics (Generic)
134 import Statistics.Types (Sample)
137 , outliers :: Outliers
138 } deriving (Eq, Read, Show, Typeable, Data, Generic)
140-instance Binary Result
141+instance Binary Result where
142+ put (Result a b c d) = put a >> put b >> put c >> put d
143+ get = Result <$> get <*> get <*> get <*> get
145 type ResultForest = [ResultTree]
146 data ResultTree = Single Result
147 | Compare !Int ResultForest
148 deriving (Eq, Read, Show, Typeable, Data, Generic)
150-instance Binary ResultTree
151+instance Binary ResultTree where
152+ put (Single x) = put (0 :: Word8) >> put x
153+ put (Compare x y) = put (1 :: Word8) >> put x >> put y
158+ 1 -> Compare <$> get <*> get
159+ _ -> error "Binary.get for ResultTree failed"
160diff -ru orig/criterion.cabal new/criterion.cabal
161--- orig/criterion.cabal 2014-04-10 08:02:35.387848687 +0300
162+++ new/criterion.cabal 2014-04-10 08:02:34.000000000 +0300
169 bytestring >= 0.9 && < 1.0,
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list