bytestring-tree-builder 0.2.2 → 0.2.2.1
raw patch · 3 files changed
+18/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
bytestring-tree-builder.cabal view
@@ -1,7 +1,7 @@ name: bytestring-tree-builder version:- 0.2.2+ 0.2.2.1 category: ByteString synopsis:
library/ByteString/TreeBuilder.hs view
@@ -11,7 +11,7 @@ ) where -import ByteString.TreeBuilder.Prelude hiding (foldl, length)+import ByteString.TreeBuilder.Prelude hiding (foldl, foldr, length) import qualified ByteString.TreeBuilder.Tree as A import qualified ByteString.TreeBuilder.Poker as D import qualified ByteString.TreeBuilder.Prelude as F@@ -69,6 +69,13 @@ A.foldl step init tree -- |+-- Performs a right-fold over the aggregated chunks.+{-# INLINE foldr #-}+foldr :: (ByteString -> a -> a) -> a -> Builder -> a+foldr step init (Builder length tree) =+ A.foldr step init tree++-- | -- /O(1)/. Gets the total length. {-# INLINE length #-} length :: Builder -> Int@@ -88,4 +95,4 @@ {-# INLINABLE toLazyByteString #-} toLazyByteString :: Builder -> E.ByteString toLazyByteString =- foldl (flip E.Chunk) E.Empty+ foldr E.Chunk E.Empty
tasty/Main.hs view
@@ -6,6 +6,7 @@ import Test.Tasty.HUnit import Test.Tasty.QuickCheck import ByteString.TreeBuilder+import qualified Data.ByteString.Lazy main =@@ -14,8 +15,13 @@ tree = testGroup "All tests" [- testProperty "Concatting a list of bytestrings is isomorphic to appending a list of builders" $+ testProperty "Concatting a list of bytestrings is isomorphic to appending a list of builders (strict)" $ \bytestrings ->- mconcat bytestrings ==+ mconcat bytestrings === toByteString (foldMap byteString bytestrings)+ ,+ testProperty "Concatting a list of bytestrings is isomorphic to appending a list of builders (lazy)" $+ \bytestrings ->+ mconcat bytestrings ===+ Data.ByteString.Lazy.toStrict (toLazyByteString (foldMap byteString bytestrings)) ]