Skip to content

Commit 2be28d5

Browse files
committed
update patches
1 parent e3af91c commit 2be28d5

File tree

6 files changed

+192
-255
lines changed

6 files changed

+192
-255
lines changed

strict-containers/patches/HashMap.patch

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,11 @@ element into (or replace an existing one in) an Array.
77

88
For more discussion see https://github.com/haskell-unordered-containers/unordered-containers/issues/311
99

10-
--- a/src/Data/Strict/HashMap/Autogen/Strict.hs
11-
+++ b/src/Data/Strict/HashMap/Autogen/Strict.hs
12-
@@ -99,13 +99,9 @@
13-
, fromList
14-
, fromListWith
15-
, fromListWithKey
16-
-
17-
- -- ** HashSets
18-
- , HS.keysSet
19-
) where
20-
21-
import Data.Strict.HashMap.Autogen.Internal.Strict as HM
22-
-import qualified Data.HashSet.Internal as HS
23-
import Prelude ()
24-
25-
-- $strictness
10+
diff --git a/src/Data/Strict/HashMap/Autogen/Internal.hs b/src/Data/Strict/HashMap/Autogen/Internal.hs
11+
index 1cb01da..dfcae84 100644
2612
--- a/src/Data/Strict/HashMap/Autogen/Internal.hs
2713
+++ b/src/Data/Strict/HashMap/Autogen/Internal.hs
28-
@@ -194,7 +194,7 @@
14+
@@ -179,7 +179,7 @@ import qualified Language.Haskell.TH.Syntax as TH
2915
hash :: H.Hashable a => a -> Hash
3016
hash = fromIntegral . H.hash
3117

@@ -34,21 +20,23 @@ For more discussion see https://github.com/haskell-unordered-containers/unordere
3420
deriving (Eq)
3521

3622
instance (NFData k, NFData v) => NFData (Leaf k v) where
23+
diff --git a/src/Data/Strict/HashMap/Autogen/Internal/Array.hs b/src/Data/Strict/HashMap/Autogen/Internal/Array.hs
24+
index 7c89f50..e789d17 100644
3725
--- a/src/Data/Strict/HashMap/Autogen/Internal/Array.hs
3826
+++ b/src/Data/Strict/HashMap/Autogen/Internal/Array.hs
39-
@@ -254,26 +254,30 @@
27+
@@ -197,15 +197,19 @@ liftRnfArray rnf0 ary0 = go ary0 n0 0
4028
-- state thread, with each element containing the specified initial
4129
-- value.
4230
new :: Int -> a -> ST s (MArray s a)
43-
-new (I# n#) b =
31+
-new _n@(I# n#) b =
4432
+new i !b = new' i b
4533
+{-# INLINE new #-}
4634
+
4735
+new' :: Int -> a -> ST s (MArray s a)
48-
+new' (I# n#) b =
49-
CHECK_GT("new",n,(0 :: Int))
36+
+new' _n@(I# n#) b =
37+
CHECK_GT("new",_n,(0 :: Int))
5038
ST $ \s ->
51-
case newArray# n# b s of
39+
case newSmallArray# n# b s of
5240
(# s', ary #) -> (# s', MArray ary #)
5341
-{-# INLINE new #-}
5442
+{-# INLINE new' #-}
@@ -57,6 +45,11 @@ For more discussion see https://github.com/haskell-unordered-containers/unordere
5745
-new_ n = new n undefinedElem
5846
+new_ n = new' n undefinedElem
5947

48+
-- | When 'Exts.shrinkSmallMutableArray#' is available, the returned array is the same as the array given, as it is shrunk in place.
49+
-- Otherwise a copy is made.
50+
@@ -222,11 +226,11 @@ shrink mary n = cloneM mary 0 n
51+
{-# INLINE shrink #-}
52+
6053
singleton :: a -> Array a
6154
-singleton x = runST (singletonM x)
6255
+singleton !x = runST (singletonM x)
@@ -67,18 +60,36 @@ For more discussion see https://github.com/haskell-unordered-containers/unordere
6760
+singletonM !x = new 1 x >>= unsafeFreeze
6861
{-# INLINE singletonM #-}
6962

63+
snoc :: Array a -> a -> Array a
64+
@@ -239,7 +243,7 @@ snoc ary x = run $ do
65+
{-# INLINE snoc #-}
66+
7067
pair :: a -> a -> Array a
7168
-pair x y = run $ do
7269
+pair !x !y = run $ do
7370
ary <- new 2 x
7471
write ary 1 y
7572
return ary
76-
@@ -286,7 +290,7 @@
73+
@@ -252,7 +256,7 @@ read ary _i@(I# i#) = ST $ \ s ->
7774
{-# INLINE read #-}
7875

7976
write :: MArray s a -> Int -> a -> ST s ()
8077
-write ary _i@(I# i#) b = ST $ \ s ->
8178
+write ary _i@(I# i#) !b = ST $ \ s ->
8279
CHECK_BOUNDS("write", lengthM ary, _i)
83-
case writeArray# (unMArray ary) i# b s of
80+
case writeSmallArray# (unMArray ary) i# b s of
8481
s' -> (# s' , () #)
82+
diff --git a/src/Data/Strict/HashMap/Autogen/Strict.hs b/src/Data/Strict/HashMap/Autogen/Strict.hs
83+
index f40bf25..c1d2d04 100644
84+
--- a/src/Data/Strict/HashMap/Autogen/Strict.hs
85+
+++ b/src/Data/Strict/HashMap/Autogen/Strict.hs
86+
@@ -100,9 +100,6 @@ module Data.Strict.HashMap.Autogen.Strict
87+
, fromList
88+
, fromListWith
89+
, fromListWithKey
90+
-
91+
- -- ** HashSets
92+
- , HS.keysSet
93+
) where
94+
95+
import Data.Strict.HashMap.Autogen.Internal.Strict

strict-containers/patches/IntMap.patch

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
diff --git a/src/Data/Strict/IntMap/Autogen/Internal.hs b/src/Data/Strict/IntMap/Autogen/Internal.hs
2+
index 0d4baee..29ababb 100644
13
--- a/src/Data/Strict/IntMap/Autogen/Internal.hs
24
+++ b/src/Data/Strict/IntMap/Autogen/Internal.hs
3-
@@ -379,7 +379,7 @@
5+
@@ -359,7 +359,7 @@ data IntMap a = Bin {-# UNPACK #-} !Prefix
46
-- the left of the Mask bit.
57
-- Invariant: In (Bin prefix mask left right), left consists of the elements that
68
-- don't have the mask bit set; right is all the elements that do.

strict-containers/patches/Map.patch

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
diff --git a/src/Data/Strict/Map/Autogen/Internal.hs b/src/Data/Strict/Map/Autogen/Internal.hs
2+
index e5303ca..949b4f6 100644
13
--- a/src/Data/Strict/Map/Autogen/Internal.hs
24
+++ b/src/Data/Strict/Map/Autogen/Internal.hs
3-
@@ -479,7 +479,7 @@
5+
@@ -458,7 +458,7 @@ m1 \\ m2 = difference m1 m2
46
-- their union @m1 <> m2@ maps @k@ to @a1@.
57

68
-- See Note: Order of constructors

strict-containers/patches/Sequence.patch

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,40 @@ in the Deep constructor.
1212

1313
We also remove the lazy adjust function, and rename the strict adjust' to adjust.
1414

15+
diff --git a/src/Data/Strict/Sequence/Autogen.hs b/src/Data/Strict/Sequence/Autogen.hs
16+
index a4582dd..8cd1431 100644
17+
--- a/src/Data/Strict/Sequence/Autogen.hs
18+
+++ b/src/Data/Strict/Sequence/Autogen.hs
19+
@@ -46,7 +46,7 @@
20+
-- * Logarithmic-time concatenation with '><'
21+
-- * Logarithmic-time splitting with 'splitAt', 'take' and 'drop'
22+
-- * Logarithmic-time access to any element with
23+
--- 'lookup', '!?', 'index', 'insertAt', 'deleteAt', 'adjust'', and 'update'
24+
+-- 'lookup', '!?', 'index', 'insertAt', 'deleteAt', 'adjust', and 'update'
25+
--
26+
-- Note that sequences are typically /slower/ than lists when using only
27+
-- operations for which they have the same big-\(O\) complexity: sequences
28+
@@ -204,7 +204,6 @@ module Data.Strict.Sequence.Autogen (
29+
(!?), -- :: Seq a -> Int -> Maybe a
30+
index, -- :: Seq a -> Int -> a
31+
adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a
32+
- adjust', -- :: (a -> a) -> Int -> Seq a -> Seq a
33+
update, -- :: Int -> a -> Seq a -> Seq a
34+
take, -- :: Int -> Seq a -> Seq a
35+
drop, -- :: Int -> Seq a -> Seq a
36+
diff --git a/src/Data/Strict/Sequence/Autogen/Internal.hs b/src/Data/Strict/Sequence/Autogen/Internal.hs
37+
index b026684..5c02404 100644
1538
--- a/src/Data/Strict/Sequence/Autogen/Internal.hs
1639
+++ b/src/Data/Strict/Sequence/Autogen/Internal.hs
17-
@@ -144,7 +144,6 @@
40+
@@ -148,7 +148,6 @@ module Data.Strict.Sequence.Autogen.Internal (
1841
(!?), -- :: Seq a -> Int -> Maybe a
1942
index, -- :: Seq a -> Int -> a
2043
adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a
2144
- adjust', -- :: (a -> a) -> Int -> Seq a -> Seq a
2245
update, -- :: Int -> a -> Seq a -> Seq a
2346
take, -- :: Int -> Seq a -> Seq a
2447
drop, -- :: Int -> Seq a -> Seq a
25-
@@ -183,11 +182,9 @@
48+
@@ -187,11 +186,9 @@ module Data.Strict.Sequence.Autogen.Internal (
2649
zipWith4, -- :: (a -> b -> c -> d -> e) -> Seq a -> Seq b -> Seq c -> Seq d -> Seq e
2750
unzip, -- :: Seq (a, b) -> (Seq a, Seq b)
2851
unzipWith, -- :: (a -> (b, c)) -> Seq a -> (Seq b, Seq c)
@@ -34,7 +57,7 @@ We also remove the lazy adjust function, and rename the strict adjust' to adjust
3457
) where
3558

3659
import Prelude hiding (
37-
@@ -995,7 +992,7 @@
60+
@@ -998,7 +995,7 @@ seqDataType = mkDataType "Data.Strict.Sequence.Autogen.Seq" [emptyConstr, consCo
3861

3962
data FingerTree a
4063
= EmptyT
@@ -43,7 +66,7 @@ We also remove the lazy adjust function, and rename the strict adjust' to adjust
4366
| Deep {-# UNPACK #-} !Int !(Digit a) (FingerTree (Node a)) !(Digit a)
4467
#ifdef TESTING
4568
deriving Show
46-
@@ -1184,10 +1181,10 @@
69+
@@ -1189,10 +1186,10 @@ pullR s pr m = case viewRTree m of
4770
-- Digits
4871

4972
data Digit a
@@ -58,7 +81,7 @@ We also remove the lazy adjust function, and rename the strict adjust' to adjust
5881
#ifdef TESTING
5982
deriving Show
6083
#endif
61-
@@ -1287,8 +1284,8 @@
84+
@@ -1294,8 +1291,8 @@ digitToTree' !_n (One a) = Single a
6285
-- Nodes
6386

6487
data Node a
@@ -69,7 +92,7 @@ We also remove the lazy adjust function, and rename the strict adjust' to adjust
6992
#ifdef TESTING
7093
deriving Show
7194
#endif
72-
@@ -2517,25 +2514,12 @@
95+
@@ -2511,25 +2508,12 @@ updateDigit v i (Four a b c d)
7396
sab = sa + size b
7497
sabc = sab + size c
7598

@@ -96,19 +119,19 @@ We also remove the lazy adjust function, and rename the strict adjust' to adjust
96119
-- case xs !? i of
97120
-- Nothing -> xs
98121
-- Just x -> let !x' = f x
99-
@@ -2543,9 +2527,9 @@
122+
@@ -2537,9 +2521,9 @@ adjust f i (Seq xs)
100123
-- @
101124
--
102125
-- @since 0.5.8
103126
-adjust' :: forall a . (a -> a) -> Int -> Seq a -> Seq a
104127
+adjust :: forall a . (a -> a) -> Int -> Seq a -> Seq a
105-
#if __GLASGOW_HASKELL__ >= 708
128+
#ifdef __GLASGOW_HASKELL__
106129
-adjust' f i xs
107130
+adjust f i xs
108131
-- See note on unsigned arithmetic in splitAt
109132
| fromIntegral i < (fromIntegral (length xs) :: Word) =
110133
coerce $ adjustTree (\ !_k (ForceBox a) -> ForceBox (f a)) i (coerce xs)
111-
@@ -2554,7 +2538,7 @@
134+
@@ -2548,7 +2532,7 @@ adjust' f i xs
112135
-- This is inefficient, but fixing it would take a lot of fuss and bother
113136
-- for little immediate gain. We can deal with that when we have another
114137
-- Haskell implementation to worry about.
@@ -117,22 +140,3 @@ We also remove the lazy adjust function, and rename the strict adjust' to adjust
117140
case xs !? i of
118141
Nothing -> xs
119142
Just x -> let !x' = f x
120-
--- a/src/Data/Strict/Sequence/Autogen.hs
121-
+++ b/src/Data/Strict/Sequence/Autogen.hs
122-
@@ -46,7 +46,7 @@
123-
-- * Logarithmic-time concatenation with '><'
124-
-- * Logarithmic-time splitting with 'splitAt', 'take' and 'drop'
125-
-- * Logarithmic-time access to any element with
126-
--- 'lookup', '!?', 'index', 'insertAt', 'deleteAt', 'adjust'', and 'update'
127-
+-- 'lookup', '!?', 'index', 'insertAt', 'deleteAt', 'adjust', and 'update'
128-
--
129-
-- Note that sequences are typically /slower/ than lists when using only
130-
-- operations for which they have the same big-\(O\) complexity: sequences
131-
@@ -204,7 +204,6 @@
132-
(!?), -- :: Seq a -> Int -> Maybe a
133-
index, -- :: Seq a -> Int -> a
134-
adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a
135-
- adjust', -- :: (a -> a) -> Int -> Seq a -> Seq a
136-
update, -- :: Int -> a -> Seq a -> Seq a
137-
take, -- :: Int -> Seq a -> Seq a
138-
drop, -- :: Int -> Seq a -> Seq a

strict-containers/patches/Vector.patch

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ type ([.. ->] a -> ..), e.g. from Data.Primitive.Array or a GHC primop.
1616

1717
For more discussion see https://github.com/haskell/vector/issues/380
1818

19-
We also re-format the data definitions due to https://github.com/haskell/haddock/issues/836
20-
vector upstream CI doesn't run haddock so they don't see this issue themselves
21-
19+
diff --git a/src/Data/Strict/Vector/Autogen.hs b/src/Data/Strict/Vector/Autogen.hs
20+
index ce0814a..fe20777 100644
2221
--- a/src/Data/Strict/Vector/Autogen.hs
2322
+++ b/src/Data/Strict/Vector/Autogen.hs
24-
@@ -175,8 +175,8 @@
23+
@@ -177,8 +177,8 @@ module Data.Strict.Vector.Autogen (
2524

2625
import Data.Strict.Vector.Autogen.Mutable ( MVector(..) )
2726
import Data.Primitive.Array
@@ -32,18 +31,7 @@ vector upstream CI doesn't run haddock so they don't see this issue themselves
3231

3332
import Control.DeepSeq ( NFData(rnf)
3433
#if MIN_VERSION_deepseq(1,4,3)
35-
@@ -232,9 +232,7 @@
36-
37-
38-
-- | Boxed vectors, supporting efficient slicing.
39-
-data Vector a = Vector {-# UNPACK #-} !Int
40-
- {-# UNPACK #-} !Int
41-
- {-# UNPACK #-} !(Array a)
42-
+data Vector a = Vector {-# UNPACK #-} !Int {-# UNPACK #-} !Int {-# UNPACK #-} !(Array a)
43-
deriving ( Typeable )
44-
45-
liftRnfV :: (a -> ()) -> Vector a -> ()
46-
@@ -306,6 +304,9 @@
34+
@@ -291,6 +289,9 @@ instance G.Vector Vector a where
4735
basicUnsafeCopy (MVector i n dst) (Vector j _ src)
4836
= copyArray dst i src j n
4937

@@ -53,29 +41,20 @@ vector upstream CI doesn't run haddock so they don't see this issue themselves
5341
-- See http://trac.haskell.org/vector/ticket/12
5442
instance Eq a => Eq (Vector a) where
5543
{-# INLINE (==) #-}
44+
diff --git a/src/Data/Strict/Vector/Autogen/Mutable.hs b/src/Data/Strict/Vector/Autogen/Mutable.hs
45+
index 5d85f12..83af3c4 100644
5646
--- a/src/Data/Strict/Vector/Autogen/Mutable.hs
5747
+++ b/src/Data/Strict/Vector/Autogen/Mutable.hs
58-
@@ -62,7 +62,7 @@
48+
@@ -71,7 +71,7 @@ module Data.Strict.Vector.Autogen.Mutable (
5949
) where
6050

6151
import Control.Monad (when, liftM)
6252
-import qualified Data.Strict.Vector.Autogen.Generic.Mutable as G
6353
+import qualified Data.Vector.Generic.Mutable as G
54+
import Data.Strict.Vector.Autogen.Internal.Check
6455
import Data.Primitive.Array
6556
import Control.Monad.Primitive
66-
67-
@@ -76,9 +76,7 @@
68-
69-
70-
-- | Mutable boxed vectors keyed on the monad they live in ('IO' or @'ST' s@).
71-
-data MVector s a = MVector {-# UNPACK #-} !Int -- ^ Offset in underlying array
72-
- {-# UNPACK #-} !Int -- ^ Size of slice
73-
- {-# UNPACK #-} !(MutableArray s a) -- ^ Underlying array
74-
+data MVector s a = MVector {-# UNPACK #-} !Int {-# UNPACK #-} !Int {-# UNPACK #-} !(MutableArray s a)
75-
deriving ( Typeable )
76-
77-
type IOVector = MVector RealWorld
78-
@@ -119,7 +117,7 @@
57+
@@ -133,7 +133,7 @@ instance G.MVector MVector a where
7958
basicInitialize _ = return ()
8059

8160
{-# INLINE basicUnsafeReplicate #-}
@@ -84,7 +63,7 @@ vector upstream CI doesn't run haddock so they don't see this issue themselves
8463
= do
8564
arr <- newArray n x
8665
return (MVector 0 n arr)
87-
@@ -128,7 +126,7 @@
66+
@@ -142,7 +142,7 @@ instance G.MVector MVector a where
8867
basicUnsafeRead (MVector i _ arr) j = readArray arr (i+j)
8968

9069
{-# INLINE basicUnsafeWrite #-}

0 commit comments

Comments
 (0)