binary-list 0.3.5.0 → 0.4.0.0
raw patch · 4 files changed
+19/−8 lines, 4 filesdep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytestring
API changes (from Hackage documentation)
+ Data.BinaryList.Serialize: instance NFData a => NFData (Decoded a)
Files
- Data/BinaryList/Internal.hs +6/−0
- Data/BinaryList/Serialize.hs +7/−0
- bench/Main.hs +0/−4
- binary-list.cabal +6/−4
Data/BinaryList/Internal.hs view
@@ -4,6 +4,8 @@ ( BinList (..) ) where +import Control.DeepSeq (NFData (..))+ -- | A binary list is a list containing a power of two elements. -- Note that a binary list is never empty. data BinList a =@@ -14,3 +16,7 @@ -- * Both l and r have 2^(n-1) elements. | ListNode {-# UNPACK #-} !Int (BinList a) (BinList a) deriving Eq++instance NFData a => NFData (BinList a) where+ rnf (ListEnd x) = rnf x+ rnf (ListNode _ l r) = rnf l `seq` rnf r
Data/BinaryList/Serialize.hs view
@@ -32,6 +32,8 @@ import Data.ByteString.Lazy (ByteString,empty) -- Backwards Applicative import Control.Applicative.Backwards+-- DeepSeq+import Control.DeepSeq (NFData (..)) -- | Encode a binary list using the 'Binary' instance of -- its elements.@@ -104,6 +106,11 @@ -- | A decoding error, with an error message and the remaining input. | DecodingError String ByteString deriving Show++instance NFData a => NFData (Decoded a) where+ rnf (PartialResult xs d) = rnf xs `seq` rnf d+ rnf (FinalResult xs b) = rnf xs `seq` rnf b+ rnf (DecodingError str b) = rnf str `seq` rnf b -- | Get the final result of a decoding process, unless it returned an error, in which -- case this error is returned as a 'String'.
bench/Main.hs view
@@ -3,14 +3,10 @@ import qualified Data.BinaryList as BL import Control.Applicative-import Control.DeepSeq import qualified Data.Foldable as F -- criterion import Criterion.Main--instance NFData a => NFData (BinList a) where- rnf xs = F.foldl1 seq xs `seq` () list1024 :: [Int] list1024 = [1..1024] -- 2^10 = 1024
binary-list.cabal view
@@ -1,6 +1,6 @@ name: binary-list-version: 0.3.5.0-synopsis: Lists of size length a power of two.+version: 0.4.0.0+synopsis: Lists of length a power of two. description: Implementation of lists whose number of elements is a power of two. Binary lists have this property by definition, so it is impossible to build a value with other kind of length.@@ -28,9 +28,12 @@ library exposed-modules: Data.BinaryList, Data.BinaryList.Serialize other-modules: Data.BinaryList.Internal- build-depends: base == 4.*, bytestring, binary >= 0.6.4.0+ build-depends: base == 4.*+ , bytestring >= 0.10.0.0+ , binary >= 0.6.4.0 , transformers >= 0.3.0.0 , phantom-state >= 0.2+ , deepseq default-language: Haskell2010 ghc-options: -Wall -fno-warn-orphans @@ -45,6 +48,5 @@ main-is: Main.hs build-depends: base == 4.* , binary-list- , deepseq , criterion ghc-options: -O2