binary-list 1.1.1.1 → 1.1.1.2
raw patch · 3 files changed
+18/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/BinaryList.hs +6/−3
- bench/Main.hs +11/−0
- binary-list.cabal +1/−1
Data/BinaryList.hs view
@@ -328,8 +328,10 @@ -- Recursion assuming both lists have the same length goEquals (ListNode n l r) (ListNode _ l' r') = ListNode (n+1) (goEquals l l') (goEquals r r')- goEquals xs ys = let (x,y) = f $ g (head xs) (head ys)- in ListNode 1 (ListEnd x) (ListEnd y)+ goEquals (ListEnd x) (ListEnd y) =+ let (x',y') = f $ g x y+ in ListNode 1 (ListEnd x') (ListEnd y')+ goEquals _ _ = undefined -- This can't happen! {-# RULES "Data.BinaryList: pairBuilder/zipWith"@@ -359,7 +361,8 @@ -- Recursion assuming both lists have the same length goEquals (ListNode n l r) (ListNode _ l' r') = ListNode n (goEquals l l') (goEquals r r')- goEquals xs ys = ListEnd $ f (head xs) (head ys)+ goEquals (ListEnd x) (ListEnd y) = ListEnd (f x y)+ goEquals _ _ = undefined -- this can't happen -- | /O(n)/. Zip two binary lists in pairs. zip :: BinList a -> BinList b -> BinList (a,b)
bench/Main.hs view
@@ -17,6 +17,9 @@ blist1024 :: BinList Int blist1024 = BL.generate 10 id +blist1024d :: BinList (Int,Int)+blist1024d = BL.zip blist1024 (BL.reverse blist1024)+ main :: IO () main = defaultMain [ bgroup "1024"@@ -26,5 +29,13 @@ , bench "generate" $ nf (\i -> BL.generate i id) 10 , bench "replicate" $ nf (\i -> BL.replicate i (0 :: Int)) 10 , bench "toListSegment" $ nf (\e -> BL.toListSegment 256 e blist1024) 768+ , bench "split" $ nf BL.split blist1024+ , bench "take" $ nf (BL.take 5) blist1024+ , bench "takeEnd" $ nf (BL.takeEnd 5) blist1024+ , bench "reverse" $ nf BL.reverse blist1024+ , bench "joinPairs" $ nf BL.joinPairs blist1024d+ , bench "disjoinPairs" $ nf BL.disjoinPairs blist1024+ , bench "zip" $ nf (\(xs,ys) -> BL.zip xs ys) (blist1024, blist1024)+ , bench "unzip" $ nf BL.unzip blist1024d ] ]
binary-list.cabal view
@@ -1,5 +1,5 @@ name: binary-list-version: 1.1.1.1+version: 1.1.1.2 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,