containers 0.5.6.0 → 0.5.6.1
raw patch · 23 files changed
+146/−207 lines, 23 filesdep ~basenew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Graph: instance Applicative (SetM s)
- Data.Graph: instance Functor (SetM s)
- Data.Graph: instance Functor SCC
- Data.Graph: instance Monad (SetM s)
- Data.Graph: instance NFData a => NFData (SCC a)
- Data.Sequence: instance Alternative Seq
- Data.Sequence: instance Applicative (State s)
- Data.Sequence: instance Applicative Identity
- Data.Sequence: instance Applicative Seq
- Data.Sequence: instance Data a => Data (Seq a)
- Data.Sequence: instance Data a => Data (ViewL a)
- Data.Sequence: instance Data a => Data (ViewR a)
- Data.Sequence: instance Eq a => Eq (Seq a)
- Data.Sequence: instance Eq a => Eq (ViewL a)
- Data.Sequence: instance Eq a => Eq (ViewR a)
- Data.Sequence: instance Foldable Digit
- Data.Sequence: instance Foldable Elem
- Data.Sequence: instance Foldable FingerTree
- Data.Sequence: instance Foldable Node
- Data.Sequence: instance Foldable Seq
- Data.Sequence: instance Foldable ViewL
- Data.Sequence: instance Foldable ViewR
- Data.Sequence: instance Functor (State s)
- Data.Sequence: instance Functor Digit
- Data.Sequence: instance Functor Elem
- Data.Sequence: instance Functor FingerTree
- Data.Sequence: instance Functor Identity
- Data.Sequence: instance Functor Node
- Data.Sequence: instance Functor Seq
- Data.Sequence: instance Functor ViewL
- Data.Sequence: instance Functor ViewR
- Data.Sequence: instance IsList (Seq a)
- Data.Sequence: instance Monad (State s)
- Data.Sequence: instance Monad Seq
- Data.Sequence: instance MonadPlus Seq
- Data.Sequence: instance Monoid (Seq a)
- Data.Sequence: instance NFData a => NFData (Digit a)
- Data.Sequence: instance NFData a => NFData (Elem a)
- Data.Sequence: instance NFData a => NFData (FingerTree a)
- Data.Sequence: instance NFData a => NFData (Node a)
- Data.Sequence: instance NFData a => NFData (Seq a)
- Data.Sequence: instance Ord a => Ord (Seq a)
- Data.Sequence: instance Ord a => Ord (ViewL a)
- Data.Sequence: instance Ord a => Ord (ViewR a)
- Data.Sequence: instance Read a => Read (Seq a)
- Data.Sequence: instance Read a => Read (ViewL a)
- Data.Sequence: instance Read a => Read (ViewR a)
- Data.Sequence: instance Show a => Show (Seq a)
- Data.Sequence: instance Show a => Show (ViewL a)
- Data.Sequence: instance Show a => Show (ViewR a)
- Data.Sequence: instance Sized (Elem a)
- Data.Sequence: instance Sized (Node a)
- Data.Sequence: instance Sized a => Sized (Digit a)
- Data.Sequence: instance Sized a => Sized (FingerTree a)
- Data.Sequence: instance Traversable Digit
- Data.Sequence: instance Traversable Elem
- Data.Sequence: instance Traversable FingerTree
- Data.Sequence: instance Traversable Node
- Data.Sequence: instance Traversable Seq
- Data.Sequence: instance Traversable ViewL
- Data.Sequence: instance Traversable ViewR
- Data.Sequence: instance Typeable Seq
- Data.Sequence: instance Typeable ViewL
- Data.Sequence: instance Typeable ViewR
- Data.Tree: instance Applicative Tree
- Data.Tree: instance Data a => Data (Tree a)
- Data.Tree: instance Eq a => Eq (Tree a)
- Data.Tree: instance Foldable Tree
- Data.Tree: instance Functor Tree
- Data.Tree: instance Monad Tree
- Data.Tree: instance NFData a => NFData (Tree a)
- Data.Tree: instance Read a => Read (Tree a)
- Data.Tree: instance Show a => Show (Tree a)
- Data.Tree: instance Traversable Tree
- Data.Tree: instance Typeable Tree
- Data.Tree: rootLabel :: Tree a -> a
- Data.Tree: subForest :: Tree a -> Forest a
+ Data.Graph: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Graph.SCC a)
+ Data.Graph: instance GHC.Base.Applicative (Data.Graph.SetM s)
+ Data.Graph: instance GHC.Base.Functor (Data.Graph.SetM s)
+ Data.Graph: instance GHC.Base.Functor Data.Graph.SCC
+ Data.Graph: instance GHC.Base.Monad (Data.Graph.SetM s)
+ Data.Sequence: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Sequence.Digit a)
+ Data.Sequence: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Sequence.Elem a)
+ Data.Sequence: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Sequence.FingerTree a)
+ Data.Sequence: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Sequence.Node a)
+ Data.Sequence: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Sequence.Seq a)
+ Data.Sequence: instance Data.Data.Data a => Data.Data.Data (Data.Sequence.Seq a)
+ Data.Sequence: instance Data.Data.Data a => Data.Data.Data (Data.Sequence.ViewL a)
+ Data.Sequence: instance Data.Data.Data a => Data.Data.Data (Data.Sequence.ViewR a)
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.Digit
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.Elem
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.FingerTree
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.Node
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.Seq
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.ViewL
+ Data.Sequence: instance Data.Foldable.Foldable Data.Sequence.ViewR
+ Data.Sequence: instance Data.Sequence.Sized (Data.Sequence.Elem a)
+ Data.Sequence: instance Data.Sequence.Sized (Data.Sequence.Node a)
+ Data.Sequence: instance Data.Sequence.Sized a => Data.Sequence.Sized (Data.Sequence.Digit a)
+ Data.Sequence: instance Data.Sequence.Sized a => Data.Sequence.Sized (Data.Sequence.FingerTree a)
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.Digit
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.Elem
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.FingerTree
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.Node
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.Seq
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.ViewL
+ Data.Sequence: instance Data.Traversable.Traversable Data.Sequence.ViewR
+ Data.Sequence: instance GHC.Base.Alternative Data.Sequence.Seq
+ Data.Sequence: instance GHC.Base.Applicative (Data.Sequence.State s)
+ Data.Sequence: instance GHC.Base.Applicative Data.Sequence.Seq
+ Data.Sequence: instance GHC.Base.Functor (Data.Sequence.State s)
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.Digit
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.Elem
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.FingerTree
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.Node
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.Seq
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.ViewL
+ Data.Sequence: instance GHC.Base.Functor Data.Sequence.ViewR
+ Data.Sequence: instance GHC.Base.Monad (Data.Sequence.State s)
+ Data.Sequence: instance GHC.Base.Monad Data.Sequence.Seq
+ Data.Sequence: instance GHC.Base.MonadPlus Data.Sequence.Seq
+ Data.Sequence: instance GHC.Base.Monoid (Data.Sequence.Seq a)
+ Data.Sequence: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Sequence.Seq a)
+ Data.Sequence: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Sequence.ViewL a)
+ Data.Sequence: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Sequence.ViewR a)
+ Data.Sequence: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Sequence.Seq a)
+ Data.Sequence: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Sequence.ViewL a)
+ Data.Sequence: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Sequence.ViewR a)
+ Data.Sequence: instance GHC.Exts.IsList (Data.Sequence.Seq a)
+ Data.Sequence: instance GHC.Read.Read a => GHC.Read.Read (Data.Sequence.Seq a)
+ Data.Sequence: instance GHC.Read.Read a => GHC.Read.Read (Data.Sequence.ViewL a)
+ Data.Sequence: instance GHC.Read.Read a => GHC.Read.Read (Data.Sequence.ViewR a)
+ Data.Sequence: instance GHC.Show.Show a => GHC.Show.Show (Data.Sequence.Seq a)
+ Data.Sequence: instance GHC.Show.Show a => GHC.Show.Show (Data.Sequence.ViewL a)
+ Data.Sequence: instance GHC.Show.Show a => GHC.Show.Show (Data.Sequence.ViewR a)
+ Data.Tree: [rootLabel] :: Tree a -> a
+ Data.Tree: [subForest] :: Tree a -> Forest a
+ Data.Tree: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Tree.Tree a)
+ Data.Tree: instance Data.Data.Data a => Data.Data.Data (Data.Tree.Tree a)
+ Data.Tree: instance Data.Foldable.Foldable Data.Tree.Tree
+ Data.Tree: instance Data.Traversable.Traversable Data.Tree.Tree
+ Data.Tree: instance GHC.Base.Applicative Data.Tree.Tree
+ Data.Tree: instance GHC.Base.Functor Data.Tree.Tree
+ Data.Tree: instance GHC.Base.Monad Data.Tree.Tree
+ Data.Tree: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Tree.Tree a)
+ Data.Tree: instance GHC.Read.Read a => GHC.Read.Read (Data.Tree.Tree a)
+ Data.Tree: instance GHC.Show.Show a => GHC.Show.Show (Data.Tree.Tree a)
Files
- Data/Graph.hs +3/−0
- Data/IntMap.hs +3/−0
- Data/IntMap/Base.hs +2/−13
- Data/IntMap/Lazy.hs +3/−0
- Data/IntMap/Strict.hs +3/−0
- Data/IntSet.hs +3/−0
- Data/IntSet/Base.hs +3/−22
- Data/Map.hs +3/−0
- Data/Map/Base.hs +3/−17
- Data/Map/Lazy.hs +3/−0
- Data/Map/Strict.hs +5/−18
- Data/Sequence.hs +21/−32
- Data/Set.hs +3/−0
- Data/Set/Base.hs +3/−16
- Data/Tree.hs +2/−7
- Data/Utils/BitUtil.hs +3/−5
- Data/Utils/StrictFold.hs +3/−0
- Data/Utils/StrictPair.hs +3/−0
- containers.cabal +12/−2
- include/Typeable.h +0/−65
- include/containers.h +61/−0
- tests/Regressions.hs +0/−9
- tests/seq-properties.hs +1/−1
Data/Graph.hs view
@@ -5,6 +5,9 @@ #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Graph
Data/IntMap.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.IntMap
Data/IntMap/Base.hs view
@@ -9,13 +9,9 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif--- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif +#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.IntMap.Base@@ -251,13 +247,7 @@ import Data.Coerce #endif --- Use macros to define strictness of functions.--- STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter.--- We do not use BangPatterns, because they are not in any standard and we--- want the compilers to be compiled by as many compilers as possible.-#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined - -- A "Nat" is a natural machine word (an unsigned Int) type Nat = Word @@ -2093,7 +2083,6 @@ Typeable --------------------------------------------------------------------} -#include "Typeable.h" INSTANCE_TYPEABLE1(IntMap,intMapTc,"IntMap") {--------------------------------------------------------------------
Data/IntMap/Lazy.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.IntMap.Lazy
Data/IntMap/Strict.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.IntMap.Strict
Data/IntSet.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.IntSet
Data/IntSet/Base.hs view
@@ -8,6 +8,9 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.IntSet.Base@@ -188,28 +191,7 @@ import GHC.Prim (indexInt8OffAddr#) #endif --- On GHC, include MachDeps.h to get WORD_SIZE_IN_BITS macro.-#if defined(__GLASGOW_HASKELL__)-# include "MachDeps.h"-#endif --- Use macros to define strictness of functions.--- STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter.--- We do not use BangPatterns, because they are not in any standard and we--- want the compilers to be compiled by as many compilers as possible.-#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined-#define STRICT_2_OF_2(fn) fn _ arg | arg `seq` False = undefined-#define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined-#define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined---- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif-- infixl 9 \\{-This comment teaches CPP correct behaviour -} -- A "Nat" is a natural machine word (an unsigned Int)@@ -1089,7 +1071,6 @@ Typeable --------------------------------------------------------------------} -#include "Typeable.h" INSTANCE_TYPEABLE0(IntSet,intSetTc,"IntSet") {--------------------------------------------------------------------
Data/Map.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Map
Data/Map/Base.hs view
@@ -9,12 +9,9 @@ {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TypeFamilies #-} #endif--- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Base@@ -298,17 +295,7 @@ import Data.Coerce #endif --- Use macros to define strictness of functions.--- STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter.--- We do not use BangPatterns, because they are not in any standard and we--- want the compilers to be compiled by as many compilers as possible.-#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined-#define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined-#define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined-#define STRICT_1_OF_4(fn) fn arg _ _ _ | arg `seq` False = undefined-#define STRICT_2_OF_4(fn) fn _ arg _ _ | arg `seq` False = undefined - {-------------------------------------------------------------------- Operators --------------------------------------------------------------------}@@ -2855,7 +2842,6 @@ Typeable --------------------------------------------------------------------} -#include "Typeable.h" INSTANCE_TYPEABLE2(Map,mapTc,"Map") {--------------------------------------------------------------------
Data/Map/Lazy.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Lazy
Data/Map/Strict.hs view
@@ -2,12 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif--- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Strict@@ -283,17 +280,6 @@ import Data.Coerce #endif --- Use macros to define strictness of functions. STRICT_x_OF_y--- denotes an y-ary function strict in the x-th parameter. Similarly--- STRICT_x_y_OF_z denotes an z-ary function strict in the x-th and--- y-th parameter. We do not use BangPatterns, because they are not--- in any standard and we want the compilers to be compiled by as many--- compilers as possible.-#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined-#define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined-#define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined-#define STRICT_1_2_OF_3(fn) fn arg1 arg2 _ | arg1 `seq` arg2 `seq` False = undefined-#define STRICT_2_OF_4(fn) fn _ arg _ _ | arg `seq` False = undefined -- $strictness --@@ -369,7 +355,8 @@ insert = go where go :: Ord k => k -> a -> Map k a -> Map k a- STRICT_1_2_OF_3(go)+ STRICT_1_OF_3(go)+ STRICT_2_OF_3(go) go kx x Tip = singleton kx x go kx x (Bin sz ky y l r) = case compare kx ky of
Data/Sequence.hs view
@@ -8,18 +8,15 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif--- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Sequence -- Copyright : (c) Ross Paterson 2005 -- (c) Louis Wasserman 2009--- (c) David Feuer and Milan Straka 2014+-- (c) David Feuer, Ross Paterson, and Milan Straka 2014 -- License : BSD-style -- Maintainer : libraries@haskell.org -- Stability : experimental@@ -161,14 +158,9 @@ import Control.Monad (MonadPlus(..), ap) import Data.Monoid (Monoid(..)) import Data.Functor (Functor(..))-#if MIN_VERSION_base(4,8,0)-import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr', toList))-#else-#if MIN_VERSION_base(4,6,0)-import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl'), toList)-#else import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', toList)-#endif+#if MIN_VERSION_base(4,8,0)+import Data.Foldable (foldr') #endif import Data.Traversable import Data.Typeable@@ -183,7 +175,6 @@ -- Array stuff, with GHC.Arr on GHC import Data.Array (Ix, Array)-import qualified Data.Array #ifdef __GLASGOW_HASKELL__ import qualified GHC.Arr #endif@@ -200,6 +191,7 @@ import Data.Functor.Identity (Identity(..)) #endif + infixr 5 `consTree` infixl 5 `snocTree` @@ -250,8 +242,6 @@ {-# INLINE length #-} null = null {-# INLINE null #-}- toList = toList- {-# INLINE toList #-} #endif instance Traversable Seq where@@ -314,7 +304,6 @@ mempty = empty mappend = (><) -#include "Typeable.h" INSTANCE_TYPEABLE1(Seq,seqTc,"Seq") #if __GLASGOW_HASKELL__@@ -1783,27 +1772,27 @@ -- There is a function 'toList' in the opposite direction for all -- instances of the 'Foldable' class, including 'Seq'. fromList :: [a] -> Seq a-fromList xs = Seq $ mkTree 1 $ map_elem xs+fromList = Seq . mkTree 1 . map_elem where {-# SPECIALIZE mkTree :: Int -> [Elem a] -> FingerTree (Elem a) #-} {-# SPECIALIZE mkTree :: Int -> [Node a] -> FingerTree (Node a) #-} mkTree :: (Sized a) => Int -> [a] -> FingerTree a- mkTree s [] = s `seq` Empty- mkTree s [x1] = s `seq` Single x1+ STRICT_1_OF_2(mkTree)+ mkTree _ [] = Empty+ mkTree _ [x1] = Single x1 mkTree s [x1, x2] = Deep (2*s) (One x1) Empty (One x2) mkTree s [x1, x2, x3] = Deep (3*s) (One x1) Empty (Two x2 x3)- mkTree s (x1:x2:x3:xs) = s `seq` case getNodes (3*s) xs of- (ns, sf) -> m `seq` deep' (Three x1 x2 x3) m sf- where m = mkTree (3*s) ns-- deep' pr@(Three x1 _ _) m sf = Deep (3*size x1 + size m + size sf) pr m sf+ mkTree s (x1:x2:x3:x4:xs) = case getNodes (3*s) x4 xs of+ (ns, sf) -> case mkTree (3*s) ns of+ m -> m `seq` Deep (3*size x1 + size m + size sf) (Three x1 x2 x3) m sf - getNodes :: Int -> [a] -> ([Node a], Digit a)- getNodes s [x1] = s `seq` ([], One x1)- getNodes s [x1, x2] = s `seq` ([], Two x1 x2)- getNodes s [x1, x2, x3] = s `seq` ([], Three x1 x2 x3)- getNodes s (x1:x2:x3:xs) = s `seq` (Node3 s x1 x2 x3:ns, d)- where (ns, d) = getNodes s xs+ getNodes :: Int -> a -> [a] -> ([Node a], Digit a)+ STRICT_1_OF_3(getNodes)+ getNodes _ x1 [] = ([], One x1)+ getNodes _ x1 [x2] = ([], Two x1 x2)+ getNodes _ x1 [x2, x3] = ([], Three x1 x2 x3)+ getNodes s x1 (x2:x3:x4:xs) = (Node3 s x1 x2 x3:ns, d)+ where (ns, d) = getNodes s x4 xs map_elem :: [a] -> [Elem a] #if __GLASGOW_HASKELL__ >= 708
Data/Set.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Set
Data/Set/Base.hs view
@@ -9,6 +9,9 @@ {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TypeFamilies #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Set.Base@@ -206,22 +209,7 @@ import Data.Data #endif --- Use macros to define strictness of functions.--- STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter.--- We do not use BangPatterns, because they are not in any standard and we--- want the compilers to be compiled by as many compilers as possible.-#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined-#define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined-#define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined --- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif-- {-------------------------------------------------------------------- Operators --------------------------------------------------------------------}@@ -1000,7 +988,6 @@ Typeable/Data --------------------------------------------------------------------} -#include "Typeable.h" INSTANCE_TYPEABLE1(Set,setTc,"Set") {--------------------------------------------------------------------
Data/Tree.hs view
@@ -5,13 +5,9 @@ #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif--- We use cabal-generated MIN_VERSION_base to adapt to changes of base.--- Nevertheless, as a convenience, we also allow compiling without cabal by--- defining trivial MIN_VERSION_base if needed.-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(major1,major2,minor) 0-#endif +#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Tree@@ -69,7 +65,6 @@ #endif type Forest a = [Tree a] -#include "Typeable.h" INSTANCE_TYPEABLE1(Tree,treeTc,"Tree") instance Functor Tree where
Data/Utils/BitUtil.hs view
@@ -5,6 +5,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif++#include "containers.h"+ ----------------------------------------------------------------------------- -- | -- Module : Data.Utils.BitUtil@@ -21,11 +24,6 @@ , shiftLL , shiftRL ) where---- On GHC, include MachDeps.h to get WORD_SIZE_IN_BITS macro.-#if defined(__GLASGOW_HASKELL__)-# include "MachDeps.h"-#endif import Data.Bits ((.|.), xor)
Data/Utils/StrictFold.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ module Data.Utils.StrictFold (foldlStrict) where -- | Same as regular 'Data.List.foldl'', but marked INLINE so that it is always
Data/Utils/StrictPair.hs view
@@ -2,6 +2,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif++#include "containers.h"+ module Data.Utils.StrictPair (StrictPair(..), toPair) where -- | Same as regular Haskell pairs, but (x :*: _|_) = (_|_ :*: y) =
containers.cabal view
@@ -1,5 +1,5 @@ name: containers-version: 0.5.6.0+version: 0.5.6.1 license: BSD3 license-file: LICENSE maintainer: fox@ucw.cz@@ -14,7 +14,7 @@ build-type: Simple cabal-version: >=1.8 extra-source-files:- include/Typeable.h+ include/containers.h tests/Makefile tests/*.hs benchmarks/Makefile@@ -85,6 +85,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -102,6 +103,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -119,6 +121,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -136,6 +139,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -153,6 +157,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -170,6 +175,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -187,6 +193,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -202,6 +209,7 @@ build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2+ include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends:@@ -225,6 +233,7 @@ test-framework-quickcheck2 >= 0.2.9 ghc-options: -Wall+ include-dirs: include test-suite intmap-strictness-properties hs-source-dirs: tests, .@@ -242,3 +251,4 @@ test-framework-quickcheck2 >= 0.2.9 ghc-options: -Wall+ include-dirs: include
− include/Typeable.h
@@ -1,65 +0,0 @@-{- ---------------------------------------------------------------------------// Macros to help make Typeable instances.-//-// INSTANCE_TYPEABLEn(tc,tcname,"tc") defines-//-// instance Typeable/n/ tc-// instance Typeable a => Typeable/n-1/ (tc a)-// instance (Typeable a, Typeable b) => Typeable/n-2/ (tc a b)-// ...-// instance (Typeable a1, ..., Typeable an) => Typeable (tc a1 ... an)-// ----------------------------------------------------------------------------}--#ifndef TYPEABLE_H-#define TYPEABLE_H--#ifdef __GLASGOW_HASKELL__---- // For GHC, we can use DeriveDataTypeable + StandaloneDeriving to--- // generate the instances.--#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon-#if __GLASGOW_HASKELL__ >= 707-#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable tycon-#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable tycon-#define INSTANCE_TYPEABLE3(tycon,tcname,str) deriving instance Typeable tycon-#else-#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable1 tycon-#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable2 tycon-#define INSTANCE_TYPEABLE3(tycon,tcname,str) deriving instance Typeable3 tycon-#endif--#else /* !__GLASGOW_HASKELL__ */--#define INSTANCE_TYPEABLE0(tycon,tcname,str) \-tcname :: TyCon; \-tcname = mkTyCon str; \-instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] }--#define INSTANCE_TYPEABLE1(tycon,tcname,str) \-tcname = mkTyCon str; \-instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \-instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault }--#define INSTANCE_TYPEABLE2(tycon,tcname,str) \-tcname = mkTyCon str; \-instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \-instance Typeable a => Typeable1 (tycon a) where { \- typeOf1 = typeOf1Default }; \-instance (Typeable a, Typeable b) => Typeable (tycon a b) where { \- typeOf = typeOfDefault }--#define INSTANCE_TYPEABLE3(tycon,tcname,str) \-tcname = mkTyCon str; \-instance Typeable3 tycon where { typeOf3 _ = mkTyConApp tcname [] }; \-instance Typeable a => Typeable2 (tycon a) where { \- typeOf2 = typeOf2Default }; \-instance (Typeable a, Typeable b) => Typeable1 (tycon a b) where { \- typeOf1 = typeOf1Default }; \-instance (Typeable a, Typeable b, Typeable c) => Typeable (tycon a b c) where { \- typeOf = typeOfDefault }--#endif /* !__GLASGOW_HASKELL__ */--#endif
+ include/containers.h view
@@ -0,0 +1,61 @@+/*+ * Common macros for containers+ */++#ifndef HASKELL_CONTAINERS_H+#define HASKELL_CONTAINERS_H++/*+ * On GHC, include MachDeps.h to get WORD_SIZE_IN_BITS macro.+ */+#ifdef __GLASGOW_HASKELL__+#include "MachDeps.h"+#endif++/*+ * Define INSTANCE_TYPEABLE[0-2]+ */+#if __GLASGOW_HASKELL__ >= 707+#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon+#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable tycon+#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable tycon+#elif defined(__GLASGOW_HASKELL__)+#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon+#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable1 tycon+#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable2 tycon+#else+#define INSTANCE_TYPEABLE0(tycon,tcname,str) tcname :: TyCon; tcname = mkTyCon str; \+ instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] }+#define INSTANCE_TYPEABLE1(tycon,tcname,str) tcname :: TyCon; tcname = mkTyCon str; \+ instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \+ instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault }+#define INSTANCE_TYPEABLE2(tycon,tcname,str) tcname :: TyCon; tcname = mkTyCon str; \+ instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \+ instance Typeable a => Typeable1 (tycon a) where { typeOf1 = typeOf1Default }; \+ instance (Typeable a, Typeable b) => Typeable (tycon a b) where { typeOf = typeOfDefault }+#endif++/*+ * Use macros to define strictness of functions.+ * STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter.+ * We do not use BangPatterns, because they are not in any standard and we+ * want the compilers to be compiled by as many compilers as possible.+ */+#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined+#define STRICT_2_OF_2(fn) fn _ arg | arg `seq` False = undefined+#define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined+#define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined+#define STRICT_1_OF_4(fn) fn arg _ _ _ | arg `seq` False = undefined+#define STRICT_2_OF_4(fn) fn _ arg _ _ | arg `seq` False = undefined++/*+ * We use cabal-generated MIN_VERSION_base to adapt to changes of base.+ * Nevertheless, as a convenience, we also allow compiling without cabal by+ * defining trivial MIN_VERSION_base if needed.+ */+#ifndef MIN_VERSION_base+#define MIN_VERSION_base(major1,major2,minor) 0+#endif+++#endif
− tests/Regressions.hs
@@ -1,9 +0,0 @@-module Main where--newtype Age = MkAge Int--main :: IO ()-main = return ()- where- -- This won't compile if the role annotations are incorrect:-
tests/seq-properties.hs view
@@ -3,7 +3,7 @@ import Control.Applicative (Applicative(..)) import Control.Arrow ((***)) import Data.Array (listArray)-import Data.Foldable (Foldable(..), toList, all, sum)+import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), toList, all, sum) import Data.Functor ((<$>), (<$)) import Data.Maybe import Data.Monoid (Monoid(..))