packages feed

containers 0.5.6.2 → 0.5.6.3

raw patch · 18 files changed

+105/−54 lines, 18 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/Graph.hs view
@@ -75,7 +75,9 @@ import Data.Tree (Tree(Node), Forest)  -- std interfaces+#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Control.DeepSeq (NFData(rnf)) import Data.Maybe import Data.Array
Data/IntMap/Base.hs view
@@ -216,16 +216,21 @@     , highestBitMask     ) where +#if MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+#else import Control.Applicative (Applicative(pure, (<*>)), (<$>))+import Data.Monoid (Monoid(..))+import Data.Traversable (Traversable(traverse))+import Data.Word (Word)+#endif+ import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Data.Bits import qualified Data.Foldable as Foldable import Data.Maybe (fromMaybe)-import Data.Monoid (Monoid(..))-import Data.Traversable (Traversable(traverse)) import Data.Typeable-import Data.Word (Word) import Prelude hiding (lookup, map, filter, foldr, foldl, null)  import Data.IntSet.Base (Key)
Data/IntSet/Base.hs view
@@ -169,9 +169,11 @@ import Data.Bits import qualified Data.List as List import Data.Maybe (fromMaybe)+#if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid(..))-import Data.Typeable import Data.Word (Word)+#endif+import Data.Typeable import Prelude hiding (filter, foldr, foldl, null, map)  import Data.Utils.BitUtil
Data/Map.hs view
@@ -45,6 +45,10 @@ -- first argument are always preferred to the second, for example in -- 'union' or 'insert'. --+-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of+-- this condition is not detected and if the size limit is exceeded, its+-- behaviour is undefined.+-- -- Operation comments contain the operation time complexity in -- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>). -----------------------------------------------------------------------------
Data/Map/Base.hs view
@@ -270,12 +270,17 @@     , filterLt     ) where +#if MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+#else import Control.Applicative (Applicative(..), (<$>))+import Data.Monoid (Monoid(..))+import Data.Traversable (Traversable(traverse))+#endif+ import Control.DeepSeq (NFData(rnf)) import Data.Bits (shiftL, shiftR) import qualified Data.Foldable as Foldable-import Data.Monoid (Monoid(..))-import Data.Traversable (Traversable(traverse)) import Data.Typeable import Prelude hiding (lookup, map, filter, foldr, foldl, null) 
Data/Map/Lazy.hs view
@@ -44,6 +44,10 @@ -- first argument are always preferred to the second, for example in -- 'union' or 'insert'. --+-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of+-- this condition is not detected and if the size limit is exceeded, its+-- behaviour is undefined.+-- -- Operation comments contain the operation time complexity in -- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>). -----------------------------------------------------------------------------
Data/Map/Strict.hs view
@@ -44,6 +44,10 @@ -- first argument are always preferred to the second, for example in -- 'union' or 'insert'. --+-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of+-- this condition is not detected and if the size limit is exceeded, its+-- behaviour is undefined.+-- -- Operation comments contain the operation time complexity in -- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>). --
Data/Sequence.hs view
@@ -16,7 +16,8 @@ -- Module      :  Data.Sequence -- Copyright   :  (c) Ross Paterson 2005 --                (c) Louis Wasserman 2009---                (c) David Feuer, Ross Paterson, and Milan Straka 2014+--                (c) Bertram Felgenhauer, David Feuer, Ross Paterson, and+--                    Milan Straka 2014 -- License     :  BSD-style -- Maintainer  :  libraries@haskell.org -- Stability   :  experimental@@ -29,7 +30,7 @@ -- -- An amortized running time is given for each operation, with /n/ referring -- to the length of the sequence and /i/ being the integral index used by--- some operations.  These bounds hold even in a persistent (shared) setting.+-- some operations. These bounds hold even in a persistent (shared) setting. -- -- The implementation uses 2-3 finger trees annotated with sizes, -- as described in section 4.2 of@@ -40,9 +41,16 @@ --      <http://staff.city.ac.uk/~ross/papers/FingerTree.html> -- -- /Note/: Many of these operations have the same names as similar--- operations on lists in the "Prelude".  The ambiguity may be resolved+-- operations on lists in the "Prelude". The ambiguity may be resolved -- using either qualification or the @hiding@ clause. --+-- /Warning/: The size of a 'Seq' must not exceed @maxBound::Int@.  Violation+-- of this condition is not detected and if the size limit is exceeded, the+-- behaviour of the sequence is undefined.  This is unlikely to occur in most+-- applications, but some care may be required when using '><', '<*>', '*>', or+-- '>>', particularly repeatedly and particularly in combination with+-- 'replicate' or 'fromFunction'.+-- -----------------------------------------------------------------------------  module Data.Sequence (@@ -147,6 +155,9 @@  import Prelude hiding (     Functor(..),+#if MIN_VERSION_base(4,8,0)+    Applicative, foldMap, Monoid,+#endif     null, length, take, drop, splitAt, foldl, foldl1, foldr, foldr1,     scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3,     takeWhile, dropWhile, iterate, reverse, filter, mapM, sum, all)@@ -175,6 +186,7 @@  -- Array stuff, with GHC.Arr on GHC import Data.Array (Ix, Array)+import qualified Data.Array #ifdef __GLASGOW_HASKELL__ import qualified GHC.Arr #endif@@ -338,15 +350,18 @@                        (Deep s (squashL pr prm) mm (squashR sfm sf)))            (fmap (fmap lastf) sfm) --- At the bottom+-- At the bottom. Note that these appendTree0 calls are very cheap, because in+-- each case, one of the arguments is guaranteed to be Empty or Single. aptyMiddle firstf            lastf            map23            fs            (Deep s pr m sf)-      = (fmap (fmap firstf) m `snocTree` fmap firstf (digitToNode sf))-        `appendTree0` middle `appendTree0`-        (fmap lastf (digitToNode pr) `consTree`  fmap (fmap lastf) m)+      = fmap (fmap firstf) m `appendTree0`+        ((fmap firstf (digitToNode sf)+            `consTree` middle)+            `snocTree` fmap lastf (digitToNode pr))+        `appendTree0`  fmap (fmap lastf) m     where middle = case trimTree $ mapMulFT s (\(Elem f) -> fmap (fmap (map23 f)) converted) fs of                      (firstMapped, restMapped, lastMapped) ->                         Deep (size firstMapped + size restMapped + size lastMapped)@@ -469,17 +484,16 @@ -- | /O(log n)/ (incremental) Rejigger a finger tree so the digits are all ones -- and twos. thin :: Sized a => FingerTree a -> FingerTree a--- Note that 'thin' may call itself at most once before passing the job on to--- 'thin12'. 'thin12' will produce a 'Deep' constructor immediately before--- calling 'thin'.+-- Note that 'thin12' will produce a 'Deep' constructor immediately before+-- recursively calling 'thin'. thin Empty = Empty thin (Single a) = Single a thin t@(Deep s pr m sf) =   case pr of     One{} -> thin12 t     Two{} -> thin12 t-    Three a b c  -> thin $ Deep s (One a) (node2 b c `consTree` m) sf-    Four a b c d -> thin $ Deep s (Two a b) (node2 c d `consTree` m) sf+    Three a b c  -> thin12 $ Deep s (One a) (node2 b c `consTree` m) sf+    Four a b c d -> thin12 $ Deep s (Two a b) (node2 c d `consTree` m) sf  thin12 :: Sized a => FingerTree a -> FingerTree a thin12 (Deep s pr m sf@One{}) = Deep s pr (thin m) sf@@ -626,13 +640,13 @@ deep pr m sf    =  Deep (size pr + size m + size sf) pr m sf  {-# INLINE pullL #-}-pullL :: Sized a => Int -> FingerTree (Node a) -> Digit a -> FingerTree a+pullL :: Int -> FingerTree (Node a) -> Digit a -> FingerTree a pullL s m sf = case viewLTree m of     Nothing2        -> digitToTree' s sf     Just2 pr m'     -> Deep s (nodeToDigit pr) m' sf  {-# INLINE pullR #-}-pullR :: Sized a => Int -> Digit a -> FingerTree (Node a) -> FingerTree a+pullR :: Int -> Digit a -> FingerTree (Node a) -> FingerTree a pullR s pr m = case viewRTree m of     Nothing2        -> digitToTree' s pr     Just2 m' sf     -> Deep s pr m' (nodeToDigit sf)@@ -856,17 +870,14 @@     4 -> deepA two emptyTree two     5 -> deepA three emptyTree two     6 -> deepA three emptyTree three-    7 -> deepA four emptyTree three-    8 -> deepA four emptyTree four     _ -> case n `quotRem` 3 of            (q,0) -> deepA three (applicativeTree (q - 2) mSize' n3) three-           (q,1) -> deepA four  (applicativeTree (q - 2) mSize' n3) three-           (q,_) -> deepA four  (applicativeTree (q - 2) mSize' n3) four+           (q,1) -> deepA two (applicativeTree (q - 1) mSize' n3) two+           (q,_) -> deepA three (applicativeTree (q - 1) mSize' n3) two   where     one = fmap One m     two = liftA2 Two m m     three = liftA3 Three m m m-    four = liftA3 Four m m m <*> m     deepA = liftA3 (Deep (n * mSize))     mSize' = 3 * mSize     n3 = liftA3 (Node3 mSize') m m m@@ -1639,6 +1650,10 @@ fromArray :: Ix i => Array i a -> Seq a #ifdef __GLASGOW_HASKELL__ fromArray a = fromFunction (GHC.Arr.numElements a) (GHC.Arr.unsafeAt a)+ where+  -- The following definition uses (Ix i) constraing, which is needed for the+  -- other fromArray definition.+  _ = Data.Array.rangeSize (Data.Array.bounds a) #else fromArray a = fromList2 (Data.Array.rangeSize (Data.Array.bounds a)) (Data.Array.elems a) #endif@@ -1825,7 +1840,7 @@ {-# SPECIALIZE tailsTree :: (FingerTree (Node a) -> Node b) -> FingerTree (Node a) -> FingerTree (Node b) #-} -- | Given a function to apply to tails of a tree, applies that function -- to every tail of the specified tree.-tailsTree :: (Sized a, Sized b) => (FingerTree a -> b) -> FingerTree a -> FingerTree b+tailsTree :: Sized a => (FingerTree a -> b) -> FingerTree a -> FingerTree b tailsTree _ Empty = Empty tailsTree f (Single x) = Single (f (Single x)) tailsTree f (Deep n pr m sf) =@@ -1840,7 +1855,7 @@ {-# SPECIALIZE initsTree :: (FingerTree (Node a) -> Node b) -> FingerTree (Node a) -> FingerTree (Node b) #-} -- | Given a function to apply to inits of a tree, applies that function -- to every init of the specified tree.-initsTree :: (Sized a, Sized b) => (FingerTree a -> b) -> FingerTree a -> FingerTree b+initsTree :: Sized a => (FingerTree a -> b) -> FingerTree a -> FingerTree b initsTree _ Empty = Empty initsTree f (Single x) = Single (f (Single x)) initsTree f (Deep n pr m sf) =@@ -2335,7 +2350,7 @@         toPQ cmp (\ (Elem x) -> PQueue x Nil) xs  -- | fromList2, given a list and its length, constructs a completely--- balanced Seq whose elements are that list using the applicativeTree+-- balanced Seq whose elements are that list using the replicateA -- generalization. fromList2 :: Int -> [a] -> Seq a fromList2 n = execState (replicateA n (State ht))
Data/Set.hs view
@@ -38,6 +38,10 @@ -- 'union' or 'insert'.  Of course, left-biasing can only be observed -- when equality is an equivalence relation instead of structural -- equality.+--+-- /Warning/: The size of the set must not exceed @maxBound::Int@. Violation of+-- this condition is not detected and if the size limit is exceeded, its+-- behaviour is undefined. -----------------------------------------------------------------------------  module Data.Set (
Data/Set/Base.hs view
@@ -45,6 +45,10 @@ -- 'union' or 'insert'.  Of course, left-biasing can only be observed -- when equality is an equivalence relation instead of structural -- equality.+--+-- /Warning/: The size of the set must not exceed @maxBound::Int@. Violation of+-- this condition is not detected and if the size limit is exceeded, its+-- behaviour is undefined. -----------------------------------------------------------------------------  -- [Note: Using INLINABLE]@@ -192,7 +196,9 @@ import Prelude hiding (filter,foldl,foldr,null,map) import qualified Data.List as List import Data.Bits (shiftL, shiftR)+#if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid(..))+#endif import qualified Data.Foldable as Foldable import Data.Typeable import Control.DeepSeq (NFData(rnf))
Data/Tree.hs view
@@ -34,13 +34,19 @@     unfoldTreeM_BF, unfoldForestM_BF,     ) where +#if MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+import Data.Foldable (toList)+#else import Control.Applicative (Applicative(..), (<$>))-import Control.Monad (liftM)+import Data.Foldable (Foldable(foldMap), toList) import Data.Monoid (Monoid(..))+import Data.Traversable (Traversable(traverse))+#endif++import Control.Monad (liftM) import Data.Sequence (Seq, empty, singleton, (<|), (|>), fromList,             ViewL(..), ViewR(..), viewl, viewr)-import Data.Foldable (Foldable(foldMap), toList)-import Data.Traversable (Traversable(traverse)) import Data.Typeable import Control.DeepSeq (NFData(rnf)) @@ -51,7 +57,6 @@ #if MIN_VERSION_base(4,8,0) import Data.Coerce #endif-  -- | Multi-way trees, also known as /rose trees/. data Tree a = Node {
benchmarks/IntMap.hs view
@@ -4,7 +4,6 @@ import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO)-import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.IntMap as M@@ -13,9 +12,8 @@  main = do     let m = M.fromAscList elems :: M.IntMap Int-    defaultMainWith-        defaultConfig-        (liftIO . evaluate $ rnf [m])+    evaluate $ rnf [m]+    defaultMain         [ bench "lookup" $ whnf (lookup keys) m         , bench "insert" $ whnf (ins elems) M.empty         , bench "insertWith empty" $ whnf (insWith elems) M.empty
benchmarks/IntSet.hs view
@@ -5,7 +5,6 @@ import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO)-import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.IntSet as S@@ -14,9 +13,8 @@     let s = S.fromAscList elems :: S.IntSet         s_even = S.fromAscList elems_even :: S.IntSet         s_odd = S.fromAscList elems_odd :: S.IntSet-    defaultMainWith-        defaultConfig-        (liftIO . evaluate $ rnf [s, s_even, s_odd])+    evaluate $ rnf [s, s_even, s_odd]+    defaultMain         [ bench "member" $ whnf (member elems) s         , bench "insert" $ whnf (ins elems) S.empty         , bench "map" $ whnf (S.map (+ 1)) s
benchmarks/Makefile view
@@ -1,10 +1,12 @@ all:  bench-%: %.hs force-	ghc -O2 -DTESTING $< -i../$(TOP) -o $@ -outputdir tmp -rtsopts+	ghc -O2 -DTESTING $< -I../include -i../$(TOP) -o $@ -outputdir tmp -rtsopts +.PRECIOUS: bench-%+ bench-%.csv: bench-%-	./bench-$* $(BENCHMARK) -v -u bench-$*.csv+	./bench-$* "$(BENCHMARK)" -v1 --csv bench-$*.csv  .PHONY: force clean veryclean force:
benchmarks/Map.hs view
@@ -4,7 +4,6 @@ import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO)-import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.Map as M@@ -15,9 +14,8 @@     let m = M.fromAscList elems :: M.Map Int Int         m_even = M.fromAscList elems_even :: M.Map Int Int         m_odd = M.fromAscList elems_odd :: M.Map Int Int-    defaultMainWith-        defaultConfig-        (liftIO . evaluate $ rnf [m, m_even, m_odd])+    evaluate $ rnf [m, m_even, m_odd]+    defaultMain         [ bench "lookup absent" $ whnf (lookup evens) m_odd         , bench "lookup present" $ whnf (lookup evens) m_even         , bench "insert absent" $ whnf (ins elems_even) m_odd
benchmarks/Sequence.hs view
@@ -3,6 +3,7 @@  import Control.Applicative import Control.DeepSeq+import Control.Exception (evaluate) import Criterion.Main import Data.List (foldl') import qualified Data.Sequence as S@@ -14,19 +15,19 @@         s100 = S.fromList [1..100] :: S.Seq Int         s1000 = S.fromList [1..1000] :: S.Seq Int         s10000 = S.fromList [1..10000] :: S.Seq Int-    rnf [s10, s100, s1000, s10000] `seq` return ()+    evaluate $ rnf [s10, s100, s1000, s10000]     let g = mkStdGen 1     let rlist n = map (`mod` (n+1)) (take 10000 (randoms g)) :: [Int]         r10 = rlist 10         r100 = rlist 100         r1000 = rlist 1000         r10000 = rlist 10000-    rnf [r10, r100, r1000, r10000] `seq` return ()+    evaluate $ rnf [r10, r100, r1000, r10000]     let u10 = S.replicate 10 () :: S.Seq ()         u100 = S.replicate 100 () :: S.Seq ()         u1000 = S.replicate 1000 () :: S.Seq ()         u10000 = S.replicate 10000 () :: S.Seq ()-    rnf [u10, u100, u1000, u10000] `seq` return ()+    evaluate $ rnf [u10, u100, u1000, u10000]     defaultMain       [ bgroup "splitAt/append"          [ bench "10" $ nf (shuffle r10) s10
benchmarks/Set.hs view
@@ -6,7 +6,6 @@ import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO)-import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.Set as S@@ -15,9 +14,8 @@     let s = S.fromAscList elems :: S.Set Int         s_even = S.fromAscList elems_even :: S.Set Int         s_odd = S.fromAscList elems_odd :: S.Set Int-    defaultMainWith-        defaultConfig-        (liftIO . evaluate $ rnf [s, s_even, s_odd])+    evaluate $ rnf [s, s_even, s_odd]+    defaultMain         [ bench "member" $ whnf (member elems) s         , bench "insert" $ whnf (ins elems) S.empty         , bench "map" $ whnf (S.map (+ 1)) s
containers.cabal view
@@ -1,5 +1,5 @@ name: containers-version: 0.5.6.2+version: 0.5.6.3 license: BSD3 license-file: LICENSE maintainer: fox@ucw.cz