Ticket #4342: containers_performance.patch

File containers_performance.patch, 234.5 KB (added by milan, 4 years ago)
Line 
110 patches for repository http://darcs.haskell.org/packages/containers:
2
3Sat Oct 16 21:57:57 CEST 2010  Milan Straka <fox@ucw.cz>
4  * Change the worker/wrapper to explicitly pass arguments.
5 
6  As the benchmarking showed, it is not a good idea to create
7  closures in the worker/wrapper transformation, as the captured
8  arguments of the enclosing function have to be allocated on the
9  heap. It is better to explicitly pass the arguments on the stack.
10  This saves memory and add no time penalty if the arguments are
11  the first arguments of recursive function (GHC refrains from
12  needless copying).
13 
14  The worker is often strict in some arguments. I did not want
15  to use BangPatterns, so I used macros to indicate strictness.
16  If majority thinks BangPatters are fine, I will gladly change it.
17
18Sat Oct 16 22:26:41 CEST 2010  Milan Straka <fox@ucw.cz>
19  * Correct a typo in macro name.
20
21Sat Oct 16 22:28:31 CEST 2010  Milan Straka <fox@ucw.cz>
22  * Whitespace changes only.
23
24Sat Oct 16 23:59:59 CEST 2010  Milan Straka <fox@ucw.cz>
25  * Changing INLINE pragmas.
26 
27  The internal functions that need to be inlined are marked INLINE
28  (bit fiddling in IntMap/IntSet, empty, singleton, bin).
29 
30  Aslo if INLINABLE is available, use it for all exported functions.
31  The functions like insert that were INLINE because of specialization
32  issues are now INLINE only in the case of INLINABLE absence.
33
34Sun Oct 17 00:21:50 CEST 2010  Milan Straka <fox@ucw.cz>
35  * Mark fold explicitely as INLINE.
36 
37  The INLINABLE does not work well in this case. Benchmarks
38  show memory savings (due to unboxing) and nearly no GHC binary
39  size increase.
40
41Tue Oct 19 22:20:43 CEST 2010  Milan Straka <fox@ucw.cz>
42  * Do not pass f explicitely for fold.
43 
44  Benchmarks shows this is a huge win (100% for (:) being
45  the function, 1000% for (+) being the function).
46
47Fri Oct 22 11:17:44 CEST 2010  Milan Straka <fox@ucw.cz>
48  * Remove INLINABLE in IntMap and IntSet.hs.
49 
50  It makes no sense, as the calls are already specialized
51  for Int keys. Benchmarks actually show small slowdown.
52
53Fri Oct 22 12:09:39 CEST 2010  Milan Straka <fox@ucw.cz>
54  * Make foldlStrict semantics to match foldl'.
55
56Sat Oct 30 01:16:53 CEST 2010  Milan Straka <fox@ucw.cz>
57  * Settle performance issues in IntMap and IntSet.
58 
59  The worker-wrapper transformation is removed from
60  all functions but lookup and member. This is the
61  only place where it causes benefits -- a 10% to
62  15% speedup. It increases memory allocation
63  slightly (0-5%), but the effect on GHC is really
64  minor.
65 
66  Also INLINE/INLINABLE hints are not really needed,
67  GHC figures it all by itself. The explicit INLINE
68  were left on internal functions that are crutial
69  to INLINE because of performance.
70
71Sun Oct 31 09:21:46 CET 2010  Milan Straka <fox@ucw.cz>
72  * Settle performance issues in Map and Set.
73 
74  Explain the INLINE/INLINABLE in the Map and Set sources.
75 
76  Use 'go' only for functions that can be INLINE.
77
78New patches:
79
80[Change the worker/wrapper to explicitly pass arguments.
81Milan Straka <fox@ucw.cz>**20101016195757
82 Ignore-this: 7f4a2180a263ee15cbb73c60b2d8cc46
83 
84 As the benchmarking showed, it is not a good idea to create
85 closures in the worker/wrapper transformation, as the captured
86 arguments of the enclosing function have to be allocated on the
87 heap. It is better to explicitly pass the arguments on the stack.
88 This saves memory and add no time penalty if the arguments are
89 the first arguments of recursive function (GHC refrains from
90 needless copying).
91 
92 The worker is often strict in some arguments. I did not want
93 to use BangPatterns, so I used macros to indicate strictness.
94 If majority thinks BangPatters are fine, I will gladly change it.
95] {
96hunk ./Data/IntMap.hs 201
97 import Data.Word
98 #endif
99 
100+-- Use macros to define strictness of functions.
101+-- STRICTxy denotes an y-ary function strict in the x-th parameter.
102+#define STRICT12(fn) fn arg _ | arg `seq` False = undefined
103+#define STRICT13(fn) fn arg _ _ | arg `seq` False = undefined
104+#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
105+#define STRICT24(fn) fn _ arg _ _ | arg `seq` False = undefined
106+
107 infixl 9 \\{-This comment teaches CPP correct behaviour -}
108 
109 -- A "Nat" is a natural machine word (an unsigned Int)
110hunk ./Data/IntMap.hs 364
111 
112 -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'.
113 lookup :: Key -> IntMap a -> Maybe a
114-lookup k = k `seq` go
115-  where go (Bin _ m l r)
116-          | zero k m  = go l
117-          | otherwise = go r
118-        go (Tip kx x)
119+lookup = go
120+  where STRICT12(go)
121+        go k (Bin _ m l r)
122+          | zero k m  = go k l
123+          | otherwise = go k r
124+        go k (Tip kx x)
125           | k == kx   = Just x
126           | otherwise = Nothing
127hunk ./Data/IntMap.hs 372
128-        go Nil        = Nothing
129+        go k Nil      = Nothing
130 #if __GLASGOW_HASKELL__>= 700
131 {-# INLINABLE lookup #-}
132 #endif
133hunk ./Data/IntMap.hs 442
134 -- > insert 5 'x' empty                         == singleton 5 'x'
135 
136 insert :: Key -> a -> IntMap a -> IntMap a
137-insert k x = k `seq` go
138-  where go t@(Bin p m l r)
139+insert = go
140+  where STRICT13(go)
141+        go k x t@(Bin p m l r)
142           | nomatch k p m = join k (Tip k x) p t
143hunk ./Data/IntMap.hs 446
144-          | zero k m      = Bin p m (insert k x l) r
145-          | otherwise     = Bin p m l (insert k x r)
146-        go t@(Tip ky _)
147+          | zero k m      = Bin p m (go k x l) r
148+          | otherwise     = Bin p m l (go k x r)
149+        go k x t@(Tip ky _)
150           | k==ky         = Tip k x
151           | otherwise     = join k (Tip k x) ky t
152hunk ./Data/IntMap.hs 451
153-        go Nil            = Tip k x
154+        go k x Nil            = Tip k x
155 #if __GLASGOW_HASKELL__>= 700
156 {-# INLINABLE insert #-}
157 #endif
158hunk ./Data/IntMap.hs 486
159 -- > insertWithKey f 5 "xxx" empty                         == singleton 5 "xxx"
160 
161 insertWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
162-insertWithKey f k x = k `seq` go
163+insertWithKey = go
164   where
165hunk ./Data/IntMap.hs 488
166-    go t@(Bin p m l r)
167+    STRICT24(go)
168+    go f k x t@(Bin p m l r)
169         | nomatch k p m = join k (Tip k x) p t
170hunk ./Data/IntMap.hs 491
171-        | zero k m      = Bin p m (go l) r
172-        | otherwise     = Bin p m l (go r)
173+        | zero k m      = Bin p m (go f k x l) r
174+        | otherwise     = Bin p m l (go f k x r)
175 
176hunk ./Data/IntMap.hs 494
177-    go t@(Tip ky y)
178+    go f k x t@(Tip ky y)
179         | k==ky         = Tip k (f k x y)
180         | otherwise     = join k (Tip k x) ky t
181 
182hunk ./Data/IntMap.hs 498
183-    go Nil = Tip k x
184+    go _ k x Nil = Tip k x
185 #if __GLASGOW_HASKELL__>= 700
186 {-# INLINABLE insertWithKey #-}
187 #endif
188hunk ./Data/IntMap.hs 520
189 -- > insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing,  fromList [(3, "b"), (5, "a"), (7, "x")])
190 
191 insertLookupWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a)
192-insertLookupWithKey f k x = k `seq` go
193+insertLookupWithKey = go
194   where
195hunk ./Data/IntMap.hs 522
196-      go t@(Bin p m l r)
197+      STRICT24(go)
198+      go f k x t@(Bin p m l r)
199         | nomatch k p m = (Nothing,join k (Tip k x) p t)
200hunk ./Data/IntMap.hs 525
201-        | zero k m      = case go l of (found, l') -> (found,Bin p m l' r)
202-        | otherwise     = case go r of (found, r') -> (found,Bin p m l r')
203+        | zero k m      = case go f k x l of (found, l') -> (found,Bin p m l' r)
204+        | otherwise     = case go f k x r of (found, r') -> (found,Bin p m l r')
205 
206hunk ./Data/IntMap.hs 528
207-      go t@(Tip ky y)
208+      go f k x t@(Tip ky y)
209         | k==ky         = (Just y,Tip k (f k x y))
210         | otherwise     = (Nothing,join k (Tip k x) ky t)
211 
212hunk ./Data/IntMap.hs 532
213-      go Nil = (Nothing,Tip k x)
214+      go _ k x Nil = (Nothing,Tip k x)
215 #if __GLASGOW_HASKELL__>= 700
216 {-# INLINABLE insertLookupWithKey #-}
217 #endif
218hunk ./Data/IntMap.hs 550
219 -- > delete 5 empty                         == empty
220 
221 delete :: Key -> IntMap a -> IntMap a
222-delete k = k `seq` go
223+delete = go
224   where
225hunk ./Data/IntMap.hs 552
226-      go t@(Bin p m l r)
227+      STRICT12(go)
228+      go k t@(Bin p m l r)
229         | nomatch k p m = t
230hunk ./Data/IntMap.hs 555
231-        | zero k m      = bin p m (go l) r
232-        | otherwise     = bin p m l (go r)
233+        | zero k m      = bin p m (go k l) r
234+        | otherwise     = bin p m l (go k r)
235 
236hunk ./Data/IntMap.hs 558
237-      go t@(Tip ky _)
238+      go k t@(Tip ky _)
239         | k==ky         = Nil
240         | otherwise     = t
241 
242hunk ./Data/IntMap.hs 562
243-      go Nil = Nil
244+      go _ Nil = Nil
245 #if __GLASGOW_HASKELL__>= 700
246 {-# INLINABLE delete #-}
247 #endif
248hunk ./Data/IntMap.hs 622
249 -- > updateWithKey f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
250 
251 updateWithKey ::  (Key -> a -> Maybe a) -> Key -> IntMap a -> IntMap a
252-updateWithKey f k = k `seq` go
253+updateWithKey = go
254   where
255hunk ./Data/IntMap.hs 624
256-      go t@(Bin p m l r)
257+      STRICT23(go)
258+      go f k t@(Bin p m l r)
259         | nomatch k p m = t
260hunk ./Data/IntMap.hs 627
261-        | zero k m      = bin p m (go l) r
262-        | otherwise     = bin p m l (go r)
263+        | zero k m      = bin p m (go f k l) r
264+        | otherwise     = bin p m l (go f k r)
265 
266hunk ./Data/IntMap.hs 630
267-      go t@(Tip ky y)
268+      go f k t@(Tip ky y)
269         | k==ky         = case f k y of
270                              Just y' -> Tip ky y'
271                              Nothing -> Nil
272hunk ./Data/IntMap.hs 636
273         | otherwise     = t
274 
275-      go Nil = Nil
276+      go _ _ Nil = Nil
277 #if __GLASGOW_HASKELL__>= 700
278 {-# INLINABLE updateWithKey #-}
279 #endif
280hunk ./Data/IntMap.hs 652
281 -- > updateLookupWithKey f 3 (fromList [(5,"a"), (3,"b")]) == (Just "b", singleton 5 "a")
282 
283 updateLookupWithKey ::  (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a,IntMap a)
284-updateLookupWithKey f k = k `seq` go
285+updateLookupWithKey = go
286   where
287hunk ./Data/IntMap.hs 654
288-      go t@(Bin p m l r)
289+      STRICT23(go)
290+      go f k t@(Bin p m l r)
291         | nomatch k p m = (Nothing,t)
292hunk ./Data/IntMap.hs 657
293-        | zero k m      = case updateLookupWithKey f k l of (found, l') -> (found,bin p m l' r)
294-        | otherwise     = case updateLookupWithKey f k r of (found, r') -> (found,bin p m l r')
295+        | zero k m      = case go f k l of (found, l') -> (found,bin p m l' r)
296+        | otherwise     = case go f k r of (found, r') -> (found,bin p m l r')
297 
298hunk ./Data/IntMap.hs 660
299-      go t@(Tip ky y)
300+      go f k t@(Tip ky y)
301         | k==ky         = case f k y of
302                              Just y' -> (Just y,Tip ky y')
303                              Nothing -> (Just y,Nil)
304hunk ./Data/IntMap.hs 666
305         | otherwise     = (Nothing,t)
306 
307-      go Nil = (Nothing,Nil)
308+      go _ _ Nil = (Nothing,Nil)
309 #if __GLASGOW_HASKELL__>= 700
310 {-# INLINABLE updateLookupWithKey #-}
311 #endif
312hunk ./Data/IntMap.hs 675
313 -- 'alter' can be used to insert, delete, or update a value in an 'IntMap'.
314 -- In short : @'lookup' k ('alter' f k m) = f ('lookup' k m)@.
315 alter :: (Maybe a -> Maybe a) -> Int -> IntMap a -> IntMap a
316-alter f k = k `seq` go
317+alter = go
318   where
319hunk ./Data/IntMap.hs 677
320-    go t@(Bin p m l r)
321+    STRICT23(go)
322+    go f k t@(Bin p m l r)
323         | nomatch k p m = case f Nothing of
324                              Nothing -> t
325                              Just x  -> join k (Tip k x) p t
326hunk ./Data/IntMap.hs 682
327-        | zero k m      = bin p m (go l) r
328-        | otherwise     = bin p m l (go r)
329+        | zero k m      = bin p m (go f k l) r
330+        | otherwise     = bin p m l (go f k r)
331 
332hunk ./Data/IntMap.hs 685
333-    go t@(Tip ky y)         
334+    go f k t@(Tip ky y)         
335         | k==ky         = case f (Just y) of
336                              Just x -> Tip ky x
337                              Nothing -> Nil
338hunk ./Data/IntMap.hs 694
339                              Just x -> join k (Tip k x) ky t
340                              Nothing -> Tip ky y
341 
342-    go Nil              = case f Nothing of
343+    go f k Nil              = case f Nothing of
344                              Just x -> Tip k x
345                              Nothing -> Nil
346 #if __GLASGOW_HASKELL__>= 700
347hunk ./Data/IntMap.hs 975
348 -- > updateMinWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
349 
350 updateMinWithKey :: (Key -> a -> a) -> IntMap a -> IntMap a
351-updateMinWithKey f = go
352+updateMinWithKey = go
353   where
354hunk ./Data/IntMap.hs 977
355-     go (Bin p m l r) | m < 0 = let t' = updateMinWithKeyUnsigned f r in Bin p m l t'
356-     go (Bin p m l r)         = let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
357-     go (Tip k y) = Tip k (f k y)
358-     go Nil       = error "maxView: empty map has no maximal element"
359+     go f (Bin p m l r) | m < 0 = let t' = updateMinWithKeyUnsigned f r in Bin p m l t'
360+     go f (Bin p m l r)         = let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
361+     go f (Tip k y) = Tip k (f k y)
362+     go f Nil       = error "maxView: empty map has no maximal element"
363 #if __GLASGOW_HASKELL__>= 700
364 {-# INLINABLE updateMinWithKey #-}
365 #endif
366hunk ./Data/IntMap.hs 986
367 
368 updateMinWithKeyUnsigned :: (Key -> a -> a) -> IntMap a -> IntMap a
369-updateMinWithKeyUnsigned f = go
370+updateMinWithKeyUnsigned = go
371   where
372hunk ./Data/IntMap.hs 988
373-     go (Bin p m l r) = let t' = go l in Bin p m t' r
374-     go (Tip k y)     = Tip k (f k y)
375-     go Nil           = error "updateMinWithKeyUnsigned Nil"
376+     go f (Bin p m l r) = let t' = go f l in Bin p m t' r
377+     go f (Tip k y)     = Tip k (f k y)
378+     go f Nil           = error "updateMinWithKeyUnsigned Nil"
379 #if __GLASGOW_HASKELL__>= 700
380 {-# INLINABLE updateMinWithKeyUnsigned #-}
381 #endif
382hunk ./Data/IntMap.hs 1001
383 -- > updateMaxWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
384 
385 updateMaxWithKey :: (Key -> a -> a) -> IntMap a -> IntMap a
386-updateMaxWithKey f = go
387+updateMaxWithKey = go
388   where
389hunk ./Data/IntMap.hs 1003
390-    go (Bin p m l r) | m < 0 = let t' = updateMaxWithKeyUnsigned f l in Bin p m t' r
391-    go (Bin p m l r)         = let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
392-    go (Tip k y)        = Tip k (f k y)
393-    go Nil              = error "maxView: empty map has no maximal element"
394+    go f (Bin p m l r) | m < 0 = let t' = updateMaxWithKeyUnsigned f l in Bin p m t' r
395+    go f (Bin p m l r)         = let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
396+    go f (Tip k y)        = Tip k (f k y)
397+    go f Nil              = error "maxView: empty map has no maximal element"
398 #if __GLASGOW_HASKELL__>= 700
399 {-# INLINABLE updateMaxWithKey #-}
400 #endif
401hunk ./Data/IntMap.hs 1012
402 
403 updateMaxWithKeyUnsigned :: (Key -> a -> a) -> IntMap a -> IntMap a
404-updateMaxWithKeyUnsigned f = go
405+updateMaxWithKeyUnsigned = go
406   where
407hunk ./Data/IntMap.hs 1014
408-    go (Bin p m l r) = let t' = go r in Bin p m l t'
409-    go (Tip k y)     = Tip k (f k y)
410-    go Nil           = error "updateMaxWithKeyUnsigned Nil"
411+    go f (Bin p m l r) = let t' = go f r in Bin p m l t'
412+    go f (Tip k y)     = Tip k (f k y)
413+    go f Nil           = error "updateMaxWithKeyUnsigned Nil"
414 #if __GLASGOW_HASKELL__>= 700
415 {-# INLINABLE updateMaxWithKeyUnsigned #-}
416 #endif
417hunk ./Data/IntMap.hs 1307
418 -- > mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]
419 
420 mapWithKey :: (Key -> a -> b) -> IntMap a -> IntMap b
421-mapWithKey f = go
422+mapWithKey = go
423   where
424hunk ./Data/IntMap.hs 1309
425-   go (Bin p m l r) = Bin p m (go l) (go r)
426-   go (Tip k x)     = Tip k (f k x)
427-   go Nil           = Nil
428+   go f (Bin p m l r) = Bin p m (go f l) (go f r)
429+   go f (Tip k x)     = Tip k (f k x)
430+   go f Nil           = Nil
431 #if __GLASGOW_HASKELL__>= 700
432 {-# INLINABLE mapWithKey #-}
433 #endif
434hunk ./Data/IntMap.hs 1390
435 -- > filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
436 
437 filterWithKey :: (Key -> a -> Bool) -> IntMap a -> IntMap a
438-filterWithKey p = go
439+filterWithKey = go
440   where
441hunk ./Data/IntMap.hs 1392
442-    go (Bin pr m l r) = bin pr m (go l) (go r)
443-    go t@(Tip k x)
444+    go p (Bin pr m l r) = bin pr m (go p l) (go p r)
445+    go p t@(Tip k x)
446         | p k x      = t
447         | otherwise  = Nil
448hunk ./Data/IntMap.hs 1396
449-    go Nil = Nil
450+    go p Nil = Nil
451 #if __GLASGOW_HASKELL__>= 700
452 {-# INLINABLE filterWithKey #-}
453 #endif
454hunk ./Data/IntMap.hs 1456
455 -- > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"
456 
457 mapMaybeWithKey :: (Key -> a -> Maybe b) -> IntMap a -> IntMap b
458-mapMaybeWithKey f = go
459+mapMaybeWithKey = go
460   where
461hunk ./Data/IntMap.hs 1458
462-    go (Bin p m l r) = bin p m (go l) (go r)
463-    go (Tip k x)     = case f k x of
464+    go f (Bin p m l r) = bin p m (go f l) (go f r)
465+    go f (Tip k x)     = case f k x of
466                           Just y  -> Tip k y
467                           Nothing -> Nil
468hunk ./Data/IntMap.hs 1462
469-    go Nil = Nil
470+    go f Nil = Nil
471 #if __GLASGOW_HASKELL__>= 700
472 {-# INLINABLE mapMaybeWithKey #-}
473 #endif
474hunk ./Data/IntMap.hs 1637
475 #endif
476 
477 foldr' :: (Key -> a -> b -> b) -> b -> IntMap a -> b
478-foldr' f = go
479+foldr' = go
480   where
481hunk ./Data/IntMap.hs 1639
482-    go z (Bin _ _ l r) = go (go z r) l
483-    go z (Tip k x)     = f k x z
484-    go z Nil           = z
485+    go f z (Bin _ _ l r) = go f (go f z r) l
486+    go f z (Tip k x)     = f k x z
487+    go f z Nil           = z
488 #if __GLASGOW_HASKELL__>= 700
489 {-# INLINABLE foldr' #-}
490 #endif
491hunk ./Data/IntMap.hs 2157
492 --------------------------------------------------------------------}
493 
494 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
495-foldlStrict f = go
496+foldlStrict = go
497   where
498hunk ./Data/IntMap.hs 2159
499-    go z []     = z
500-    go z (x:xs) = z `seq` go (f z x) xs
501+    STRICT23(go)
502+    go f z []     = z
503+    go f z (x:xs) = go f (f z x) xs
504 #if __GLASGOW_HASKELL__>= 700
505 {-# INLINABLE foldlStrict #-}
506 #endif
507hunk ./Data/IntSet.hs 135
508 import Data.Word
509 #endif
510 
511+-- Use macros to define strictness of functions.
512+-- STRICTxy denotes an y-ary function strict in the x-th parameter.
513+#define STRICT12(fn) fn arg _ | arg `seq` False = undefined
514+#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
515+
516 infixl 9 \\{-This comment teaches CPP correct behaviour -}
517 
518 -- A "Nat" is a natural machine word (an unsigned Int)
519hunk ./Data/IntSet.hs 246
520 
521 -- | /O(min(n,W))/. Is the value a member of the set?
522 member :: Int -> IntSet -> Bool
523-member x Nil = x `seq` False
524-member x t = x `seq` go t
525-  where go (Bin p m l r)
526+member = go
527+  where STRICT12(go)
528+        go x (Bin p m l r)
529           | nomatch x p m = False
530hunk ./Data/IntSet.hs 250
531-          | zero x m      = go l
532-          | otherwise     = go r
533-        go (Tip y) = x == y
534+          | zero x m      = go x l
535+          | otherwise     = go x r
536+        go x (Tip y) = x == y
537+        go _ Nil = False
538 #if __GLASGOW_HASKELL__>= 700
539 {-# INLINABLE member #-}
540 #endif
541hunk ./Data/IntSet.hs 267
542 
543 -- 'lookup' is used by 'intersection' for left-biasing
544 lookup :: Int -> IntSet -> Maybe Int
545-lookup k Nil = k `seq` Nothing
546-lookup k t = k `seq` go t
547-  where go (Bin _ m l r)
548-          | zero k m  = go l
549-          | otherwise = go r
550-        go (Tip kx)
551+lookup = go
552+  where STRICT12(go)
553+        go k (Bin _ m l r)
554+          | zero k m  = go k l
555+          | otherwise = go k r
556+        go k (Tip kx)
557           | k == kx   = Just kx
558           | otherwise = Nothing
559hunk ./Data/IntSet.hs 275
560+        go _ Nil = Nothing
561 #if __GLASGOW_HASKELL__>= 700
562 {-# INLINABLE lookup #-}
563 #endif
564hunk ./Data/IntSet.hs 306
565 -- an element of the set, it is replaced by the new one, ie. 'insert'
566 -- is left-biased.
567 insert :: Int -> IntSet -> IntSet
568-insert x = x `seq` go
569-  where go t@(Bin p m l r )
570+insert = go
571+  where STRICT12(go)
572+        go x t@(Bin p m l r )
573           | nomatch x p m = join x (Tip x) p t
574hunk ./Data/IntSet.hs 310
575-          | zero x m      = Bin p m (go l) r
576-          | otherwise     = Bin p m l (go r)
577-        go t@(Tip y)
578+          | zero x m      = Bin p m (go x l) r
579+          | otherwise     = Bin p m l (go x r)
580+        go x t@(Tip y)
581           | x==y          = Tip x
582           | otherwise     = join x (Tip x) y t
583hunk ./Data/IntSet.hs 315
584-        go Nil            = Tip x
585+        go x Nil            = Tip x
586 #if __GLASGOW_HASKELL__>= 700
587 {-# INLINABLE insert #-}
588 #endif
589hunk ./Data/IntSet.hs 322
590 
591 -- right-biased insertion, used by 'union'
592 insertR :: Int -> IntSet -> IntSet
593-insertR x = x `seq` go
594-  where go t@(Bin p m l r )
595+insertR = go
596+  where STRICT12(go)
597+        go x t@(Bin p m l r )
598           | nomatch x p m = join x (Tip x) p t
599hunk ./Data/IntSet.hs 326
600-          | zero x m      = Bin p m (go l) r
601-          | otherwise     = Bin p m l (go r)
602-        go t@(Tip y)
603+          | zero x m      = Bin p m (go x l) r
604+          | otherwise     = Bin p m l (go x r)
605+        go x t@(Tip y)
606           | x==y          = t
607           | otherwise     = join x (Tip x) y t
608hunk ./Data/IntSet.hs 331
609-        go Nil            = Tip x
610+        go x Nil            = Tip x
611 #if __GLASGOW_HASKELL__>= 700
612 {-# INLINABLE insertR #-}
613 #endif
614hunk ./Data/IntSet.hs 339
615 -- | /O(min(n,W))/. Delete a value in the set. Returns the
616 -- original set when the value was not present.
617 delete :: Int -> IntSet -> IntSet
618-delete x = x `seq` go
619-  where go t@(Bin p m l r)
620+delete = go
621+  where STRICT12(go)
622+        go x t@(Bin p m l r)
623           | nomatch x p m = t
624hunk ./Data/IntSet.hs 343
625-          | zero x m      = bin p m (go l) r
626-          | otherwise     = bin p m l (go r)
627-        go t@(Tip y)
628+          | zero x m      = bin p m (go x l) r
629+          | otherwise     = bin p m l (go x r)
630+        go x t@(Tip y)
631           | x==y          = Nil
632           | otherwise     = t
633hunk ./Data/IntSet.hs 348
634-        go t@Nil          = t
635+        go _ t@Nil          = t
636 #if __GLASGOW_HASKELL__>= 700
637 {-# INLINABLE delete #-}
638 #endif
639hunk ./Data/IntSet.hs 1159
640   Utilities
641 --------------------------------------------------------------------}
642 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
643-foldlStrict f z xs
644-  = case xs of
645-      []     -> z
646-      (x:xx) -> let z' = f z x in seq z' (foldlStrict f z' xx)
647+foldlStrict = go
648+  where
649+    STRICT23(go)
650+    go f z []     = z
651+    go f z (x:xs) = go f (f z x) xs
652 #if __GLASGOW_HASKELL__>= 700
653 {-# INLINABLE foldlStrict #-}
654 #endif
655hunk ./Data/Map.hs 211
656 import Data.Data (Data(..), mkNoRepType, gcast2)
657 #endif
658 
659+-- Use macros to define strictness of functions.
660+-- STRICTxy denotes an y-ary function strict in the x-th parameter.
661+#define STRICT12(fn) fn arg _ | arg `seq` False = undefined
662+#define STRICT13(fn) fn arg _ _ | arg `seq` False = undefined
663+#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
664+#define STRICT24(fn) fn _ arg _ _ | arg `seq` False = undefined
665+
666 {--------------------------------------------------------------------
667   Operators
668 --------------------------------------------------------------------}
669hunk ./Data/Map.hs 333
670 -- >   Pete's currency: Nothing
671 
672 lookup :: Ord k => k -> Map k a -> Maybe a
673-lookup k = k `seq` go
674+lookup = go
675   where
676hunk ./Data/Map.hs 335
677-    go Tip = Nothing
678-    go (Bin _ kx x l r) =
679+    STRICT12(go)
680+    go k Tip = Nothing
681+    go k (Bin _ kx x l r) =
682         case compare k kx of
683hunk ./Data/Map.hs 339
684-            LT -> go l
685-            GT -> go r
686+            LT -> go k l
687+            GT -> go k r
688             EQ -> Just x
689 {-# INLINE lookup #-}
690 
691hunk ./Data/Map.hs 345
692 lookupAssoc :: Ord k => k -> Map k a -> Maybe (k,a)
693-lookupAssoc k = k `seq` go
694+lookupAssoc = go
695   where
696hunk ./Data/Map.hs 347
697-    go Tip = Nothing
698-    go (Bin _ kx x l r) =
699+    STRICT12(go)
700+    go k Tip = Nothing
701+    go k (Bin _ kx x l r) =
702         case compare k kx of
703hunk ./Data/Map.hs 351
704-            LT -> go l
705-            GT -> go r
706+            LT -> go k l
707+            GT -> go k r
708             EQ -> Just (kx,x)
709 {-# INLINE lookupAssoc #-}
710 
711hunk ./Data/Map.hs 440
712 -- > insert 5 'x' empty                         == singleton 5 'x'
713 
714 insert :: Ord k => k -> a -> Map k a -> Map k a
715-insert kx x = kx `seq` go
716+insert = go
717   where
718hunk ./Data/Map.hs 442
719-    go Tip = singleton kx x
720-    go (Bin sz ky y l r) =
721+    STRICT13(go)
722+    go kx x Tip = singleton kx x
723+    go kx x (Bin sz ky y l r) =
724         case compare kx ky of
725hunk ./Data/Map.hs 446
726-            LT -> balanceL ky y (go l) r
727-            GT -> balanceR ky y l (go r)
728+            LT -> balanceL ky y (go kx x l) r
729+            GT -> balanceR ky y l (go kx x r)
730             EQ -> Bin sz kx x l r
731 {-# INLINE insert #-}
732 
733hunk ./Data/Map.hs 489
734 -- > insertWithKey f 5 "xxx" empty                         == singleton 5 "xxx"
735 
736 insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
737-insertWithKey f kx x = kx `seq` go
738+insertWithKey = go
739   where
740hunk ./Data/Map.hs 491
741-    go Tip = singleton kx x
742-    go (Bin sy ky y l r) =
743+    STRICT24(go)
744+    go f kx x Tip = singleton kx x
745+    go f kx x (Bin sy ky y l r) =
746         case compare kx ky of
747hunk ./Data/Map.hs 495
748-            LT -> balanceL ky y (go l) r
749-            GT -> balanceR ky y l (go r)
750+            LT -> balanceL ky y (go f kx x l) r
751+            GT -> balanceR ky y l (go f kx x r)
752             EQ -> Bin sy kx (f kx x y) l r
753 {-# INLINE insertWithKey #-}
754 
755hunk ./Data/Map.hs 502
756 -- | Same as 'insertWithKey', but the combining function is applied strictly.
757 insertWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
758-insertWithKey' f kx x = kx `seq` go
759+insertWithKey' = go
760   where
761hunk ./Data/Map.hs 504
762-    go Tip = singleton kx $! x
763-    go (Bin sy ky y l r) =
764+    STRICT24(go)
765+    go f kx x Tip = x `seq` singleton kx x
766+    go f kx x (Bin sy ky y l r) =
767         case compare kx ky of
768hunk ./Data/Map.hs 508
769-            LT -> balanceL ky y (go l) r
770-            GT -> balanceR ky y l (go r)
771-            EQ -> let x' = f kx x y in seq x' (Bin sy kx x' l r)
772+            LT -> balanceL ky y (go f kx x l) r
773+            GT -> balanceR ky y l (go f kx x r)
774+            EQ -> let x' = f kx x y in x' `seq` (Bin sy kx x' l r)
775 {-# INLINE insertWithKey' #-}
776 
777 -- | /O(log n)/. Combines insert operation with old value retrieval.
778hunk ./Data/Map.hs 531
779 
780 insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a
781                     -> (Maybe a, Map k a)
782-insertLookupWithKey f kx x = kx `seq` go
783+insertLookupWithKey = go
784   where
785hunk ./Data/Map.hs 533
786-    go Tip = (Nothing, singleton kx x)
787-    go (Bin sy ky y l r) =
788+    STRICT24(go)
789+    go f kx x Tip = (Nothing, singleton kx x)
790+    go f kx x (Bin sy ky y l r) =
791         case compare kx ky of
792hunk ./Data/Map.hs 537
793-            LT -> let (found, l') = go l
794+            LT -> let (found, l') = go f kx x l
795                   in (found, balanceL ky y l' r)
796hunk ./Data/Map.hs 539
797-            GT -> let (found, r') = go r
798+            GT -> let (found, r') = go f kx x r
799                   in (found, balanceR ky y l r')
800             EQ -> (Just y, Bin sy kx (f kx x y) l r)
801 {-# INLINE insertLookupWithKey #-}
802hunk ./Data/Map.hs 547
803 -- | /O(log n)/. A strict version of 'insertLookupWithKey'.
804 insertLookupWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a
805                      -> (Maybe a, Map k a)
806-insertLookupWithKey' f kx x = kx `seq` go
807+insertLookupWithKey' = go
808   where
809hunk ./Data/Map.hs 549
810-    go Tip = x `seq` (Nothing, singleton kx x)
811-    go (Bin sy ky y l r) =
812+    STRICT24(go)
813+    go f kx x Tip = x `seq` (Nothing, singleton kx x)
814+    go f kx x (Bin sy ky y l r) =
815         case compare kx ky of
816hunk ./Data/Map.hs 553
817-            LT -> let (found, l') = go l
818+            LT -> let (found, l') = go f kx x l
819                   in (found, balanceL ky y l' r)
820hunk ./Data/Map.hs 555
821-            GT -> let (found, r') = go r
822+            GT -> let (found, r') = go f kx x r
823                   in (found, balanceR ky y l r')
824             EQ -> let x' = f kx x y in x' `seq` (Just y, Bin sy kx x' l r)
825 {-# INLINE insertLookupWithKey' #-}
826hunk ./Data/Map.hs 572
827 -- > delete 5 empty                         == empty
828 
829 delete :: Ord k => k -> Map k a -> Map k a
830-delete k = k `seq` go
831+delete = go
832   where
833hunk ./Data/Map.hs 574
834-    go Tip = Tip
835-    go (Bin _ kx x l r) =
836+    STRICT12(go)
837+    go k Tip = Tip
838+    go k (Bin _ kx x l r) =
839         case compare k kx of
840hunk ./Data/Map.hs 578
841-            LT -> balanceR kx x (go l) r
842-            GT -> balanceL kx x l (go r)
843+            LT -> balanceR kx x (go k l) r
844+            GT -> balanceL kx x l (go k r)
845             EQ -> glue l r
846 {-# INLINE delete #-}
847 
848hunk ./Data/Map.hs 631
849 -- > updateWithKey f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
850 
851 updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a
852-updateWithKey f k = k `seq` go
853+updateWithKey = go
854   where
855hunk ./Data/Map.hs 633
856-    go Tip = Tip
857-    go (Bin sx kx x l r) =
858+    STRICT23(go)
859+    go f k Tip = Tip
860+    go f k(Bin sx kx x l r) =
861         case compare k kx of
862hunk ./Data/Map.hs 637
863-           LT -> balanceR kx x (go l) r
864-           GT -> balanceL kx x l (go r)
865+           LT -> balanceR kx x (go f k l) r
866+           GT -> balanceL kx x l (go f k r)
867            EQ -> case f kx x of
868                    Just x' -> Bin sx kx x' l r
869                    Nothing -> glue l r
870hunk ./Data/Map.hs 654
871 -- > updateLookupWithKey f 3 (fromList [(5,"a"), (3,"b")]) == (Just "b", singleton 5 "a")
872 
873 updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a,Map k a)
874-updateLookupWithKey f k = k `seq` go
875+updateLookupWithKey = go
876  where
877hunk ./Data/Map.hs 656
878-   go Tip = (Nothing,Tip)
879-   go (Bin sx kx x l r) =
880+   STRICT23(go)
881+   go f k Tip = (Nothing,Tip)
882+   go f k (Bin sx kx x l r) =
883           case compare k kx of
884hunk ./Data/Map.hs 660
885-               LT -> let (found,l') = go l in (found,balanceR kx x l' r)
886-               GT -> let (found,r') = go r in (found,balanceL kx x l r')
887+               LT -> let (found,l') = go f k l in (found,balanceR kx x l' r)
888+               GT -> let (found,r') = go f k r in (found,balanceL kx x l r')
889                EQ -> case f kx x of
890                        Just x' -> (Just x',Bin sx kx x' l r)
891                        Nothing -> (Just x,glue l r)
892hunk ./Data/Map.hs 680
893 -- > alter f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "c")]
894 
895 alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a
896-alter f k = k `seq` go
897+alter = go
898   where
899hunk ./Data/Map.hs 682
900-    go Tip = case f Nothing of
901+    STRICT23(go)
902+    go f k Tip = case f Nothing of
903                Nothing -> Tip
904                Just x  -> singleton k x
905 
906hunk ./Data/Map.hs 687
907-    go (Bin sx kx x l r) = case compare k kx of
908-               LT -> balance kx x (go l) r
909-               GT -> balance kx x l (go r)
910+    go f k (Bin sx kx x l r) = case compare k kx of
911+               LT -> balance kx x (go f k l) r
912+               GT -> balance kx x l (go f k r)
913                EQ -> case f (Just x) of
914                        Just x' -> Bin sx kx x' l r
915                        Nothing -> glue l r
916hunk ./Data/Map.hs 725
917 -- > isJust (lookupIndex 6 (fromList [(5,"a"), (3,"b")]))   == False
918 
919 lookupIndex :: Ord k => k -> Map k a -> Maybe Int
920-lookupIndex k = k `seq` go 0
921+lookupIndex k = go k 0
922   where
923hunk ./Data/Map.hs 727
924-    go idx Tip  = idx `seq` Nothing
925-    go idx (Bin _ kx _ l r)
926-      = idx `seq` case compare k kx of
927-          LT -> go idx l
928-          GT -> go (idx + size l + 1) r
929+    STRICT13(go)
930+    STRICT23(go)
931+    go k idx Tip  = Nothing
932+    go k idx (Bin _ kx _ l r)
933+      = case compare k kx of
934+          LT -> go k idx l
935+          GT -> go k (idx + size l + 1) r
936           EQ -> Just (idx + size l)
937 #if __GLASGOW_HASKELL__>= 700
938 {-# INLINABLE lookupIndex #-}
939hunk ./Data/Map.hs 747
940 -- > elemAt 2 (fromList [(5,"a"), (3,"b")])    Error: index out of range
941 
942 elemAt :: Int -> Map k a -> (k,a)
943+STRICT12(elemAt)
944 elemAt _ Tip = error "Map.elemAt: index out of range"
945 elemAt i (Bin _ kx x l r)
946   = case compare i sizeL of
947hunk ./Data/Map.hs 773
948 -- > updateAt (\_ _  -> Nothing)  (-1) (fromList [(5,"a"), (3,"b")])    Error: index out of range
949 
950 updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a
951-updateAt f i0 t = i0 `seq` go i0 t
952+updateAt = go
953  where
954hunk ./Data/Map.hs 775
955-    go _ Tip  = error "Map.updateAt: index out of range"
956-    go i (Bin sx kx x l r) = case compare i sizeL of
957-      LT -> balanceR kx x (go i l) r
958-      GT -> balanceL kx x l (go (i-sizeL-1) r)
959+    STRICT23(go)
960+    go f _ Tip  = error "Map.updateAt: index out of range"
961+    go f i (Bin sx kx x l r) = case compare i sizeL of
962+      LT -> balanceR kx x (go f i l) r
963+      GT -> balanceL kx x l (go f (i-sizeL-1) r)
964       EQ -> case f kx x of
965               Just x' -> Bin sx kx x' l r
966               Nothing -> glue l r
967hunk ./Data/Map.hs 891
968 -- > updateMinWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
969 
970 updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
971-updateMinWithKey f = go
972+updateMinWithKey = go
973  where
974hunk ./Data/Map.hs 893
975-    go (Bin sx kx x Tip r) = case f kx x of
976+    go f (Bin sx kx x Tip r) = case f kx x of
977                                   Nothing -> r
978                                   Just x' -> Bin sx kx x' Tip r
979hunk ./Data/Map.hs 896
980-    go (Bin _ kx x l r)    = balanceR kx x (go l) r
981-    go Tip                 = Tip
982+    go f (Bin _ kx x l r)    = balanceR kx x (go f l) r
983+    go f Tip                 = Tip
984 #if __GLASGOW_HASKELL__>= 700
985 {-# INLINABLE updateMinWithKey #-}
986 #endif
987hunk ./Data/Map.hs 908
988 -- > updateMaxWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
989 
990 updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
991-updateMaxWithKey f = go
992+updateMaxWithKey = go
993  where
994hunk ./Data/Map.hs 910
995-    go (Bin sx kx x l Tip) = case f kx x of
996+    go f (Bin sx kx x l Tip) = case f kx x of
997                               Nothing -> l
998                               Just x' -> Bin sx kx x' l Tip
999hunk ./Data/Map.hs 913
1000-    go (Bin _ kx x l r)    = balanceL kx x l (go r)
1001-    go Tip                 = Tip
1002+    go f (Bin _ kx x l r)    = balanceL kx x l (go f r)
1003+    go f Tip                 = Tip
1004 #if __GLASGOW_HASKELL__>= 700
1005 {-# INLINABLE updateMaxWithKey #-}
1006 #endif
1007hunk ./Data/Map.hs 1357
1008 -- > filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
1009 
1010 filterWithKey :: Ord k => (k -> a -> Bool) -> Map k a -> Map k a
1011-filterWithKey p = go
1012+filterWithKey = go
1013   where
1014hunk ./Data/Map.hs 1359
1015-    go Tip = Tip
1016-    go (Bin _ kx x l r)
1017-          | p kx x    = join kx x (go l) (go r)
1018-          | otherwise = merge (go l) (go r)
1019+    go p Tip = Tip
1020+    go p (Bin _ kx x l r)
1021+          | p kx x    = join kx x (go p l) (go p r)
1022+          | otherwise = merge (go p l) (go p r)
1023 #if __GLASGOW_HASKELL__>= 700
1024 {-# INLINABLE filterWithKey #-}
1025 #endif
1026hunk ./Data/Map.hs 1419
1027 -- > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"
1028 
1029 mapMaybeWithKey :: Ord k => (k -> a -> Maybe b) -> Map k a -> Map k b
1030-mapMaybeWithKey f = go
1031+mapMaybeWithKey = go
1032   where
1033hunk ./Data/Map.hs 1421
1034-    go Tip = Tip
1035-    go (Bin _ kx x l r) = case f kx x of
1036-        Just y  -> join kx y (go l) (go r)
1037-        Nothing -> merge (go l) (go r)
1038+    go f Tip = Tip
1039+    go f (Bin _ kx x l r) = case f kx x of
1040+        Just y  -> join kx y (go f l) (go f r)
1041+        Nothing -> merge (go f l) (go f r)
1042 #if __GLASGOW_HASKELL__>= 700
1043 {-# INLINABLE mapMaybeWithKey #-}
1044 #endif
1045hunk ./Data/Map.hs 1486
1046 -- > mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]
1047 
1048 mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
1049-mapWithKey f = go
1050+mapWithKey = go
1051   where
1052hunk ./Data/Map.hs 1488
1053-    go Tip = Tip
1054-    go (Bin sx kx x l r) = Bin sx kx (f kx x) (go l) (go r)
1055+    go f Tip = Tip
1056+    go f (Bin sx kx x l r) = Bin sx kx (f kx x) (go f l) (go f r)
1057 #if __GLASGOW_HASKELL__>= 700
1058 {-# INLINABLE mapWithKey #-}
1059 #endif
1060hunk ./Data/Map.hs 1523
1061 -- | /O(n)/. The function 'mapAccumL' threads an accumulating
1062 -- argument throught the map in ascending order of keys.
1063 mapAccumL :: (a -> k -> b -> (a,c)) -> a -> Map k b -> (a,Map k c)
1064-mapAccumL f = go
1065+mapAccumL = go
1066   where
1067hunk ./Data/Map.hs 1525
1068-    go a Tip               = (a,Tip)
1069-    go a (Bin sx kx x l r) =
1070-                 let (a1,l') = go a l
1071+    go f a Tip               = (a,Tip)
1072+    go f a (Bin sx kx x l r) =
1073+                 let (a1,l') = go f a l
1074                      (a2,x') = f a1 kx x
1075hunk ./Data/Map.hs 1529
1076-                     (a3,r') = go a2 r
1077+                     (a3,r') = go f a2 r
1078                  in (a3,Bin sx kx x' l' r')
1079 #if __GLASGOW_HASKELL__>= 700
1080 {-# INLINABLE mapAccumL #-}
1081hunk ./Data/Map.hs 1538
1082 -- | /O(n)/. The function 'mapAccumR' threads an accumulating
1083 -- argument through the map in descending order of keys.
1084 mapAccumRWithKey :: (a -> k -> b -> (a,c)) -> a -> Map k b -> (a,Map k c)
1085-mapAccumRWithKey f = go
1086+mapAccumRWithKey = go
1087   where
1088hunk ./Data/Map.hs 1540
1089-    go a Tip = (a,Tip)
1090-    go a (Bin sx kx x l r) =
1091-                 let (a1,r') = go a r
1092+    go f a Tip = (a,Tip)
1093+    go f a (Bin sx kx x l r) =
1094+                 let (a1,r') = go f a r
1095                      (a2,x') = f a1 kx x
1096hunk ./Data/Map.hs 1544
1097-                     (a3,l') = go a2 l
1098+                     (a3,l') = go f a2 l
1099                  in (a3,Bin sx kx x' l' r')
1100 #if __GLASGOW_HASKELL__>= 700
1101 {-# INLINABLE mapAccumRWithKey #-}
1102hunk ./Data/Map.hs 1650
1103 -- | /O(n)/. Post-order fold.  The function will be applied from the lowest
1104 -- value to the highest.
1105 foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b
1106-foldrWithKey f = go
1107+foldrWithKey = go
1108   where
1109hunk ./Data/Map.hs 1652
1110-    go z Tip              = z
1111-    go z (Bin _ kx x l r) = go (f kx x (go z r)) l
1112+    go f z Tip              = z
1113+    go f z (Bin _ kx x l r) = go f (f kx x (go f z r)) l
1114 #if __GLASGOW_HASKELL__>= 700
1115 {-# INLINABLE foldrWithKey #-}
1116 #endif
1117hunk ./Data/Map.hs 1661
1118 -- | /O(n)/. Pre-order fold.  The function will be applied from the highest
1119 -- value to the lowest.
1120 foldlWithKey :: (b -> k -> a -> b) -> b -> Map k a -> b
1121-foldlWithKey f = go
1122+foldlWithKey = go
1123   where
1124hunk ./Data/Map.hs 1663
1125-    go z Tip              = z
1126-    go z (Bin _ kx x l r) = go (f (go z l) kx x) r
1127+    go f z Tip              = z
1128+    go f z (Bin _ kx x l r) = go f (f (go f z l) kx x) r
1129 #if __GLASGOW_HASKELL__>= 700
1130 {-# INLINABLE foldlWithKey #-}
1131 #endif
1132hunk ./Data/Map.hs 1931
1133 --------------------------------------------------------------------}
1134 trim :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k a
1135 trim NothingS   NothingS   t = t
1136-trim (JustS lo) NothingS   t = greater t where greater (Bin _ k _ _ r) | k <= lo = greater r
1137-                                               greater t' = t'
1138-trim NothingS   (JustS hi) t = lesser t  where lesser  (Bin _ k _ l _) | k >= hi = lesser  l
1139-                                               lesser  t' = t'
1140-trim (JustS lo) (JustS hi) t = middle t  where middle  (Bin _ k _ _ r) | k <= lo = middle  r
1141-                                               middle  (Bin _ k _ l _) | k >= hi = middle  l
1142-                                               middle  t' = t'
1143+trim (JustS lo) NothingS   t = greater lo t where greater lo (Bin _ k _ _ r) | k <= lo = greater lo r
1144+                                                  greater lo t' = t'
1145+trim NothingS   (JustS hi) t = lesser hi t  where lesser  hi (Bin _ k _ l _) | k >= hi = lesser  hi l
1146+                                                  lesser  hi t' = t'
1147+trim (JustS lo) (JustS hi) t = middle lo hi t  where middle lo hi (Bin _ k _ _ r) | k <= lo = middle lo hi r
1148+                                                     middle lo hi (Bin _ k _ l _) | k >= hi = middle lo hi l
1149+                                                     middle lo hi t' = t'
1150 #if __GLASGOW_HASKELL__>= 700
1151 {-# INLINABLE trim #-}
1152 #endif
1153hunk ./Data/Map.hs 1964
1154 --------------------------------------------------------------------}
1155 filterGt :: Ord k => MaybeS k -> Map k v -> Map k v
1156 filterGt NothingS t = t
1157-filterGt (JustS b) t = filter' t
1158-  where filter' Tip = Tip
1159-        filter' (Bin _ kx x l r) = case compare b kx of LT -> join kx x (filter' l) r
1160-                                                        EQ -> r
1161-                                                        GT -> filter' r
1162+filterGt (JustS b) t = filter' b t
1163+  where filter' b Tip = Tip
1164+        filter' b (Bin _ kx x l r) = case compare b kx of LT -> join kx x (filter' b l) r
1165+                                                          EQ -> r
1166+                                                          GT -> filter' b r
1167 #if __GLASGOW_HASKELL__>= 700
1168 {-# INLINABLE filterGt #-}
1169 #endif
1170hunk ./Data/Map.hs 1975
1171 
1172 filterLt :: Ord k => MaybeS k -> Map k v -> Map k v
1173 filterLt NothingS t = t
1174-filterLt (JustS b) t = filter' t
1175-  where filter' Tip = Tip
1176-        filter' (Bin _ kx x l r) = case compare kx b of LT -> join kx x l (filter' r)
1177-                                                        EQ -> l
1178-                                                        GT -> filter' l
1179+filterLt (JustS b) t = filter' b t
1180+  where filter' b Tip = Tip
1181+        filter' b (Bin _ kx x l r) = case compare kx b of LT -> join kx x l (filter' b r)
1182+                                                          EQ -> l
1183+                                                          GT -> filter' b l
1184 #if __GLASGOW_HASKELL__>= 700
1185 {-# INLINABLE filterLt #-}
1186 #endif
1187hunk ./Data/Map.hs 1998
1188 -- > split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty)
1189 
1190 split :: Ord k => k -> Map k a -> (Map k a,Map k a)
1191-split k = go
1192+split = go
1193   where
1194hunk ./Data/Map.hs 2000
1195-    go Tip              = (Tip, Tip)
1196-    go (Bin _ kx x l r) = case compare k kx of
1197-          LT -> let (lt,gt) = go l in (lt,join kx x gt r)
1198-          GT -> let (lt,gt) = go r in (join kx x l lt,gt)
1199+    STRICT12(go)
1200+    go k Tip              = (Tip, Tip)
1201+    go k (Bin _ kx x l r) = case compare k kx of
1202+          LT -> let (lt,gt) = go k l in (lt,join kx x gt r)
1203+          GT -> let (lt,gt) = go k r in (join kx x l lt,gt)
1204           EQ -> (l,r)
1205 #if __GLASGOW_HASKELL__>= 700
1206 {-# INLINABLE split #-}
1207hunk ./Data/Map.hs 2020
1208 -- > splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty)
1209 
1210 splitLookup :: Ord k => k -> Map k a -> (Map k a,Maybe a,Map k a)
1211-splitLookup k = go
1212+splitLookup = go
1213   where
1214hunk ./Data/Map.hs 2022
1215-    go Tip              = (Tip,Nothing,Tip)
1216-    go (Bin _ kx x l r) = case compare k kx of
1217-      LT -> let (lt,z,gt) = go l in (lt,z,join kx x gt r)
1218-      GT -> let (lt,z,gt) = go r in (join kx x l lt,z,gt)
1219+    STRICT12(go)
1220+    go k Tip              = (Tip,Nothing,Tip)
1221+    go k (Bin _ kx x l r) = case compare k kx of
1222+      LT -> let (lt,z,gt) = go k l in (lt,z,join kx x gt r)
1223+      GT -> let (lt,z,gt) = go k r in (join kx x l lt,z,gt)
1224       EQ -> (l,Just x,r)
1225 #if __GLASGOW_HASKELL__>= 700
1226 {-# INLINABLE splitLookup #-}
1227hunk ./Data/Map.hs 2034
1228 
1229 -- | /O(log n)/.
1230 splitLookupWithKey :: Ord k => k -> Map k a -> (Map k a,Maybe (k,a),Map k a)
1231-splitLookupWithKey k = go
1232+splitLookupWithKey = go
1233   where
1234hunk ./Data/Map.hs 2036
1235-    go Tip              = (Tip,Nothing,Tip)
1236-    go (Bin _ kx x l r) = case compare k kx of
1237-      LT -> let (lt,z,gt) = go l in (lt,z,join kx x gt r)
1238-      GT -> let (lt,z,gt) = go r in (join kx x l lt,z,gt)
1239+    STRICT12(go)
1240+    go k Tip              = (Tip,Nothing,Tip)
1241+    go k (Bin _ kx x l r) = case compare k kx of
1242+      LT -> let (lt,z,gt) = go k l in (lt,z,join kx x gt r)
1243+      GT -> let (lt,z,gt) = go k r in (join kx x l lt,z,gt)
1244       EQ -> (l,Just (kx, x),r)
1245 #if __GLASGOW_HASKELL__>= 700
1246 {-# INLINABLE splitLookupWithKey #-}
1247hunk ./Data/Map.hs 2538
1248   Utilities
1249 --------------------------------------------------------------------}
1250 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
1251-foldlStrict f = go
1252+foldlStrict = go
1253   where
1254hunk ./Data/Map.hs 2540
1255-    go z []     = z
1256-    go z (x:xs) = z `seq` go (f z x) xs
1257+    STRICT23(go)
1258+    go f z []     = z
1259+    go f z (x:xs) = go f (f z x) xs
1260 #if __GLASGOW_HASKELL__>= 700
1261 {-# INLINABLE foldlStrict #-}
1262 #endif
1263hunk ./Data/Set.hs 138
1264 import Data.Data (Data(..), mkNoRepType, gcast1)
1265 #endif
1266 
1267+-- Use macros to define strictness of functions.
1268+-- STRICTxy denotes an y-ary function strict in the x-th parameter.
1269+#define STRICT12(fn) fn arg _ | arg `seq` False = undefined
1270+#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
1271+
1272 {--------------------------------------------------------------------
1273   Operators
1274 --------------------------------------------------------------------}
1275hunk ./Data/Set.hs 214
1276 
1277 -- | /O(log n)/. Is the element in the set?
1278 member :: Ord a => a -> Set a -> Bool
1279-member x = x `seq` go
1280+member = go
1281   where
1282hunk ./Data/Set.hs 216
1283-    go Tip = False
1284-    go (Bin _ y l r) = case compare x y of
1285-        LT -> go l
1286-        GT -> go r
1287-        EQ -> True       
1288+    STRICT12(go)
1289+    go x Tip = False
1290+    go x (Bin _ y l r) = case compare x y of
1291+          LT -> go x l
1292+          GT -> go x r
1293+          EQ -> True
1294 {-# INLINE member #-}
1295hunk ./Data/Set.hs 223
1296-       
1297+
1298 -- | /O(log n)/. Is the element not in the set?
1299 notMember :: Ord a => a -> Set a -> Bool
1300 notMember a t = not $ member a t
1301hunk ./Data/Set.hs 253
1302 -- If the set already contains an element equal to the given value,
1303 -- it is replaced with the new value.
1304 insert :: Ord a => a -> Set a -> Set a
1305-insert x = x `seq` go
1306+insert = go
1307   where
1308hunk ./Data/Set.hs 255
1309-    go Tip = singleton x
1310-    go (Bin sz y l r) = case compare x y of
1311-        LT -> balanceL y (go l) r
1312-        GT -> balanceR y l (go r)
1313+    STRICT12(go)
1314+    go x Tip = singleton x
1315+    go x (Bin sz y l r) = case compare x y of
1316+        LT -> balanceL y (go x l) r
1317+        GT -> balanceR y l (go x r)
1318         EQ -> Bin sz x l r
1319 {-# INLINE insert #-}
1320 
1321hunk ./Data/Set.hs 266
1322 -- Insert an element to the set only if it is not in the set. Used by
1323 -- `union`.
1324 insertR :: Ord a => a -> Set a -> Set a
1325-insertR x = x `seq` go
1326+insertR = go
1327   where
1328hunk ./Data/Set.hs 268
1329-    go Tip = singleton x
1330-    go t@(Bin _ y l r) = case compare x y of
1331-        LT -> balanceL y (go l) r
1332-        GT -> balanceR y l (go r)
1333+    STRICT12(go)
1334+    go x Tip = singleton x
1335+    go x t@(Bin _ y l r) = case compare x y of
1336+        LT -> balanceL y (go x l) r
1337+        GT -> balanceR y l (go x r)
1338         EQ -> t
1339 {-# INLINE insertR #-}
1340 
1341hunk ./Data/Set.hs 278
1342 -- | /O(log n)/. Delete an element from a set.
1343 delete :: Ord a => a -> Set a -> Set a
1344-delete x = x `seq` go
1345+delete = go
1346   where
1347hunk ./Data/Set.hs 280
1348-    go Tip = Tip
1349-    go (Bin _ y l r) = case compare x y of
1350-        LT -> balanceR y (go l) r
1351-        GT -> balanceL y l (go r)
1352+    STRICT12(go)
1353+    go x Tip = Tip
1354+    go x (Bin _ y l r) = case compare x y of
1355+        LT -> balanceR y (go x l) r
1356+        GT -> balanceL y l (go x r)
1357         EQ -> glue l r
1358 {-# INLINE delete #-}
1359 
1360hunk ./Data/Set.hs 538
1361 
1362 -- | /O(n)/. Post-order fold.
1363 foldr :: (a -> b -> b) -> b -> Set a -> b
1364-foldr f = go
1365+foldr = go
1366   where
1367hunk ./Data/Set.hs 540
1368-    go z Tip           = z
1369-    go z (Bin _ x l r) = go (f x (go z r)) l
1370+    go f z Tip           = z
1371+    go f z (Bin _ x l r) = go f (f x (go f z r)) l
1372 #if __GLASGOW_HASKELL__>= 700
1373 {-# INLINABLE foldr #-}
1374 #endif
1375hunk ./Data/Set.hs 709
1376 --------------------------------------------------------------------}
1377 trim :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a
1378 trim NothingS   NothingS   t = t
1379-trim (JustS lx) NothingS   t = greater t where greater (Bin _ x _ r) | x <= lx = greater r
1380-                                               greater t' = t'
1381-trim NothingS   (JustS hx) t = lesser t  where lesser  (Bin _ x l _) | x >= hx = lesser  l
1382-                                               lesser  t' = t'
1383-trim (JustS lx) (JustS hx) t = middle t  where middle  (Bin _ x _ r) | x <= lx = middle  r
1384-                                               middle  (Bin _ x l _) | x >= hx = middle  l
1385-                                               middle  t' = t'
1386+trim (JustS lx) NothingS   t = greater lx t where greater lx (Bin _ x _ r) | x <= lx = greater lx r
1387+                                                  greater _  t' = t'
1388+trim NothingS   (JustS hx) t = lesser hx t  where lesser  hx (Bin _ x l _) | x >= hx = lesser  hx l
1389+                                                  lesser  _  t' = t'
1390+trim (JustS lx) (JustS hx) t = middle lx hx t  where middle lx hx (Bin _ x _ r) | x <= lx = middle lx hx r
1391+                                                     middle lx hx (Bin _ x l _) | x >= hx = middle lx hx l
1392+                                                     middle _  _  t' = t'
1393 #if __GLASGOW_HASKELL__>= 700
1394 {-# INLINABLE trim #-}
1395 #endif
1396hunk ./Data/Set.hs 726
1397 --------------------------------------------------------------------}
1398 filterGt :: Ord a => MaybeS a -> Set a -> Set a
1399 filterGt NothingS t = t
1400-filterGt (JustS b) t = filter' t
1401-  where filter' Tip = Tip
1402-        filter' (Bin _ x l r) = case compare b x of LT -> join x (filter' l) r
1403-                                                    EQ -> r
1404-                                                    GT -> filter' r
1405+filterGt (JustS b) t = filter' b t
1406+  where filter' b Tip = Tip
1407+        filter' b (Bin _ x l r) = case compare b x of LT -> join x (filter' b l) r
1408+                                                      EQ -> r
1409+                                                      GT -> filter' b r
1410 #if __GLASGOW_HASKELL__>= 700
1411 {-# INLINABLE filterGt #-}
1412 #endif
1413hunk ./Data/Set.hs 737
1414 
1415 filterLt :: Ord a => MaybeS a -> Set a -> Set a
1416 filterLt NothingS t = t
1417-filterLt (JustS b) t = filter' t
1418-  where filter' Tip = Tip
1419-        filter' (Bin _ x l r) = case compare x b of LT -> join x l (filter' r)
1420-                                                    EQ -> l
1421-                                                    GT -> filter' l
1422+filterLt (JustS b) t = filter' b t
1423+  where filter' b Tip = Tip
1424+        filter' b (Bin _ x l r) = case compare x b of LT -> join x l (filter' b r)
1425+                                                      EQ -> l
1426+                                                      GT -> filter' b l
1427 #if __GLASGOW_HASKELL__>= 700
1428 {-# INLINABLE filterLt #-}
1429 #endif
1430hunk ./Data/Set.hs 1062
1431   Utilities
1432 --------------------------------------------------------------------}
1433 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
1434-foldlStrict f = go
1435+foldlStrict = go
1436   where
1437hunk ./Data/Set.hs 1064
1438-    go z []     = z
1439-    go z (x:xs) = z `seq` go (f z x) xs
1440+    STRICT23(go)
1441+    go f z []     = z
1442+    go f z (x:xs) = go f (f z x) xs
1443 #if __GLASGOW_HASKELL__>= 700
1444 {-# INLINABLE foldlStrict #-}
1445 #endif
1446}
1447[Correct a typo in macro name.
1448Milan Straka <fox@ucw.cz>**20101016202641
1449 Ignore-this: 356621b0ca954f73d543fc33d43383b2
1450] hunk ./Data/IntMap.hs 1045
1451         Bin p m l r -> let (result,t') = maxViewUnsigned r in (result,bin p m l t')
1452         Tip k y -> ((k,y), Nil)
1453         Nil -> error "maxViewUnsigned Nil"
1454-#if __GLASGOW_HASKELL >= 700
1455+#if __GLASGOW_HASKELL__ >= 700
1456 {-# INLINABLE maxViewUnsigned #-}
1457 #endif
1458 
1459[Whitespace changes only.
1460Milan Straka <fox@ucw.cz>**20101016202831
1461 Ignore-this: 8850e09fb49937b54da6585d01aade9a
1462] {
1463hunk ./Data/IntMap.hs 318
1464 null :: IntMap a -> Bool
1465 null Nil = True
1466 null _   = False
1467-#if __GLASGOW_HASKELL__>= 700
1468+#if __GLASGOW_HASKELL__ >= 700
1469 {-# INLINABLE null #-}
1470 #endif
1471 
1472hunk ./Data/IntMap.hs 333
1473       Bin _ _ l r -> size l + size r
1474       Tip _ _ -> 1
1475       Nil     -> 0
1476-#if __GLASGOW_HASKELL__>= 700
1477+#if __GLASGOW_HASKELL__ >= 700
1478 {-# INLINABLE size #-}
1479 #endif
1480 
1481hunk ./Data/IntMap.hs 347
1482   = case lookup k m of
1483       Nothing -> False
1484       Just _  -> True
1485-#if __GLASGOW_HASKELL__>= 700
1486+#if __GLASGOW_HASKELL__ >= 700
1487 {-# INLINABLE member #-}
1488 #endif
1489 
1490hunk ./Data/IntMap.hs 358
1491 
1492 notMember :: Key -> IntMap a -> Bool
1493 notMember k m = not $ member k m
1494-#if __GLASGOW_HASKELL__>= 700
1495+#if __GLASGOW_HASKELL__ >= 700
1496 {-# INLINABLE notMember #-}
1497 #endif
1498 
1499hunk ./Data/IntMap.hs 373
1500           | k == kx   = Just x
1501           | otherwise = Nothing
1502         go k Nil      = Nothing
1503-#if __GLASGOW_HASKELL__>= 700
1504+#if __GLASGOW_HASKELL__ >= 700
1505 {-# INLINABLE lookup #-}
1506 #endif
1507 
1508hunk ./Data/IntMap.hs 382
1509   = case lookup k m of
1510       Nothing -> error ("IntMap.find: key " ++ show k ++ " is not an element of the map")
1511       Just x  -> x
1512-#if __GLASGOW_HASKELL__>= 700
1513+#if __GLASGOW_HASKELL__ >= 700
1514 {-# INLINABLE find #-}
1515 #endif
1516 
1517hunk ./Data/IntMap.hs 398
1518   = case lookup k m of
1519       Nothing -> def
1520       Just x  -> x
1521-#if __GLASGOW_HASKELL__>= 700
1522+#if __GLASGOW_HASKELL__ >= 700
1523 {-# INLINABLE findWithDefault #-}
1524 #endif
1525 
1526hunk ./Data/IntMap.hs 413
1527 empty :: IntMap a
1528 empty
1529   = Nil
1530-#if __GLASGOW_HASKELL__>= 700
1531+#if __GLASGOW_HASKELL__ >= 700
1532 {-# INLINABLE empty #-}
1533 #endif
1534 
1535hunk ./Data/IntMap.hs 425
1536 singleton :: Key -> a -> IntMap a
1537 singleton k x
1538   = Tip k x
1539-#if __GLASGOW_HASKELL__>= 700
1540+#if __GLASGOW_HASKELL__ >= 700
1541 {-# INLINABLE singleton #-}
1542 #endif
1543 
1544hunk ./Data/IntMap.hs 452
1545           | k==ky         = Tip k x
1546           | otherwise     = join k (Tip k x) ky t
1547         go k x Nil            = Tip k x
1548-#if __GLASGOW_HASKELL__>= 700
1549+#if __GLASGOW_HASKELL__ >= 700
1550 {-# INLINABLE insert #-}
1551 #endif
1552 
1553hunk ./Data/IntMap.hs 470
1554 insertWith :: (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
1555 insertWith f k x t
1556   = insertWithKey (\_ x' y' -> f x' y') k x t
1557-#if __GLASGOW_HASKELL__>= 700
1558+#if __GLASGOW_HASKELL__ >= 700
1559 {-# INLINABLE insertWith #-}
1560 #endif
1561 
1562hunk ./Data/IntMap.hs 499
1563         | otherwise     = join k (Tip k x) ky t
1564 
1565     go _ k x Nil = Tip k x
1566-#if __GLASGOW_HASKELL__>= 700
1567+#if __GLASGOW_HASKELL__ >= 700
1568 {-# INLINABLE insertWithKey #-}
1569 #endif
1570 
1571hunk ./Data/IntMap.hs 533
1572         | otherwise     = (Nothing,join k (Tip k x) ky t)
1573 
1574       go _ k x Nil = (Nothing,Tip k x)
1575-#if __GLASGOW_HASKELL__>= 700
1576+#if __GLASGOW_HASKELL__ >= 700
1577 {-# INLINABLE insertLookupWithKey #-}
1578 #endif
1579 
1580hunk ./Data/IntMap.hs 563
1581         | otherwise     = t
1582 
1583       go _ Nil = Nil
1584-#if __GLASGOW_HASKELL__>= 700
1585+#if __GLASGOW_HASKELL__ >= 700
1586 {-# INLINABLE delete #-}
1587 #endif
1588 
1589hunk ./Data/IntMap.hs 577
1590 adjust ::  (a -> a) -> Key -> IntMap a -> IntMap a
1591 adjust f k m
1592   = adjustWithKey (\_ x -> f x) k m
1593-#if __GLASGOW_HASKELL__>= 700
1594+#if __GLASGOW_HASKELL__ >= 700
1595 {-# INLINABLE adjust #-}
1596 #endif
1597 
1598hunk ./Data/IntMap.hs 592
1599 adjustWithKey ::  (Key -> a -> a) -> Key -> IntMap a -> IntMap a
1600 adjustWithKey f
1601   = updateWithKey (\k' x -> Just (f k' x))
1602-#if __GLASGOW_HASKELL__>= 700
1603+#if __GLASGOW_HASKELL__ >= 700
1604 {-# INLINABLE adjustWithKey #-}
1605 #endif
1606 
1607hunk ./Data/IntMap.hs 608
1608 update ::  (a -> Maybe a) -> Key -> IntMap a -> IntMap a
1609 update f
1610   = updateWithKey (\_ x -> f x)
1611-#if __GLASGOW_HASKELL__>= 700
1612+#if __GLASGOW_HASKELL__ >= 700
1613 {-# INLINABLE update #-}
1614 #endif
1615 
1616hunk ./Data/IntMap.hs 637
1617         | otherwise     = t
1618 
1619       go _ _ Nil = Nil
1620-#if __GLASGOW_HASKELL__>= 700
1621+#if __GLASGOW_HASKELL__ >= 700
1622 {-# INLINABLE updateWithKey #-}
1623 #endif
1624 
1625hunk ./Data/IntMap.hs 667
1626         | otherwise     = (Nothing,t)
1627 
1628       go _ _ Nil = (Nothing,Nil)
1629-#if __GLASGOW_HASKELL__>= 700
1630+#if __GLASGOW_HASKELL__ >= 700
1631 {-# INLINABLE updateLookupWithKey #-}
1632 #endif
1633 
1634hunk ./Data/IntMap.hs 697
1635     go f k Nil              = case f Nothing of
1636                              Just x -> Tip k x
1637                              Nothing -> Nil
1638-#if __GLASGOW_HASKELL__>= 700
1639+#if __GLASGOW_HASKELL__ >= 700
1640 {-# INLINABLE alter #-}
1641 #endif
1642 
1643hunk ./Data/IntMap.hs 715
1644 unions :: [IntMap a] -> IntMap a
1645 unions xs
1646   = foldlStrict union empty xs
1647-#if __GLASGOW_HASKELL__>= 700
1648+#if __GLASGOW_HASKELL__ >= 700
1649 {-# INLINABLE unions #-}
1650 #endif
1651 
1652hunk ./Data/IntMap.hs 727
1653 unionsWith :: (a->a->a) -> [IntMap a] -> IntMap a
1654 unionsWith f ts
1655   = foldlStrict (unionWith f) empty ts
1656-#if __GLASGOW_HASKELL__>= 700
1657+#if __GLASGOW_HASKELL__ >= 700
1658 {-# INLINABLE unionsWith #-}
1659 #endif
1660 
1661hunk ./Data/IntMap.hs 756
1662 union t (Tip k x) = insertWith (\_ y -> y) k x t  -- right bias
1663 union Nil t       = t
1664 union t Nil       = t
1665-#if __GLASGOW_HASKELL__>= 700
1666+#if __GLASGOW_HASKELL__ >= 700
1667 {-# INLINABLE union #-}
1668 #endif
1669 
1670hunk ./Data/IntMap.hs 767
1671 unionWith :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
1672 unionWith f m1 m2
1673   = unionWithKey (\_ x y -> f x y) m1 m2
1674-#if __GLASGOW_HASKELL__>= 700
1675+#if __GLASGOW_HASKELL__ >= 700
1676 {-# INLINABLE unionWith #-}
1677 #endif
1678 
1679hunk ./Data/IntMap.hs 795
1680 unionWithKey f t (Tip k x) = insertWithKey (\k' x' y' -> f k' y' x') k x t  -- right bias
1681 unionWithKey _ Nil t  = t
1682 unionWithKey _ t Nil  = t
1683-#if __GLASGOW_HASKELL__>= 700
1684+#if __GLASGOW_HASKELL__ >= 700
1685 {-# INLINABLE unionWithKey #-}
1686 #endif
1687 
1688hunk ./Data/IntMap.hs 828
1689 difference Nil _       = Nil
1690 difference t (Tip k _) = delete k t
1691 difference t Nil       = t
1692-#if __GLASGOW_HASKELL__>= 700
1693+#if __GLASGOW_HASKELL__ >= 700
1694 {-# INLINABLE difference #-}
1695 #endif
1696 
1697hunk ./Data/IntMap.hs 841
1698 differenceWith :: (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
1699 differenceWith f m1 m2
1700   = differenceWithKey (\_ x y -> f x y) m1 m2
1701-#if __GLASGOW_HASKELL__>= 700
1702+#if __GLASGOW_HASKELL__ >= 700
1703 {-# INLINABLE differenceWith #-}
1704 #endif
1705 
1706hunk ./Data/IntMap.hs 879
1707 differenceWithKey _ Nil _       = Nil
1708 differenceWithKey f t (Tip k y) = updateWithKey (\k' x -> f k' x y) k t
1709 differenceWithKey _ t Nil       = t
1710-#if __GLASGOW_HASKELL__>= 700
1711+#if __GLASGOW_HASKELL__ >= 700
1712 {-# INLINABLE differenceWithKey #-}
1713 #endif
1714 
1715hunk ./Data/IntMap.hs 915
1716       Nothing -> Nil
1717 intersection Nil _ = Nil
1718 intersection _ Nil = Nil
1719-#if __GLASGOW_HASKELL__>= 700
1720+#if __GLASGOW_HASKELL__ >= 700
1721 {-# INLINABLE intersection #-}
1722 #endif
1723 
1724hunk ./Data/IntMap.hs 926
1725 intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
1726 intersectionWith f m1 m2
1727   = intersectionWithKey (\_ x y -> f x y) m1 m2
1728-#if __GLASGOW_HASKELL__>= 700
1729+#if __GLASGOW_HASKELL__ >= 700
1730 {-# INLINABLE intersectionWith #-}
1731 #endif
1732 
1733hunk ./Data/IntMap.hs 960
1734       Nothing -> Nil
1735 intersectionWithKey _ Nil _ = Nil
1736 intersectionWithKey _ _ Nil = Nil
1737-#if __GLASGOW_HASKELL__>= 700
1738+#if __GLASGOW_HASKELL__ >= 700
1739 {-# INLINABLE intersectionWithKey #-}
1740 #endif
1741 
1742hunk ./Data/IntMap.hs 981
1743      go f (Bin p m l r)         = let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
1744      go f (Tip k y) = Tip k (f k y)
1745      go f Nil       = error "maxView: empty map has no maximal element"
1746-#if __GLASGOW_HASKELL__>= 700
1747+#if __GLASGOW_HASKELL__ >= 700
1748 {-# INLINABLE updateMinWithKey #-}
1749 #endif
1750 
1751hunk ./Data/IntMap.hs 991
1752      go f (Bin p m l r) = let t' = go f l in Bin p m t' r
1753      go f (Tip k y)     = Tip k (f k y)
1754      go f Nil           = error "updateMinWithKeyUnsigned Nil"
1755-#if __GLASGOW_HASKELL__>= 700
1756+#if __GLASGOW_HASKELL__ >= 700
1757 {-# INLINABLE updateMinWithKeyUnsigned #-}
1758 #endif
1759 
1760hunk ./Data/IntMap.hs 1007
1761     go f (Bin p m l r)         = let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
1762     go f (Tip k y)        = Tip k (f k y)
1763     go f Nil              = error "maxView: empty map has no maximal element"
1764-#if __GLASGOW_HASKELL__>= 700
1765+#if __GLASGOW_HASKELL__ >= 700
1766 {-# INLINABLE updateMaxWithKey #-}
1767 #endif
1768 
1769hunk ./Data/IntMap.hs 1017
1770     go f (Bin p m l r) = let t' = go f r in Bin p m l t'
1771     go f (Tip k y)     = Tip k (f k y)
1772     go f Nil           = error "updateMaxWithKeyUnsigned Nil"
1773-#if __GLASGOW_HASKELL__>= 700
1774+#if __GLASGOW_HASKELL__ >= 700
1775 {-# INLINABLE updateMaxWithKeyUnsigned #-}
1776 #endif
1777 
1778hunk ./Data/IntMap.hs 1035
1779         Bin p m l r         -> let (result, t') = maxViewUnsigned r in Just (result, bin p m l t')
1780         Tip k y -> Just ((k,y), Nil)
1781         Nil -> Nothing
1782-#if __GLASGOW_HASKELL__>= 700
1783+#if __GLASGOW_HASKELL__ >= 700
1784 {-# INLINABLE maxViewWithKey #-}
1785 #endif
1786 
1787hunk ./Data/IntMap.hs 1062
1788         Bin p m l r         -> let (result, t') = minViewUnsigned l in Just (result, bin p m t' r)
1789         Tip k y -> Just ((k,y),Nil)
1790         Nil -> Nothing
1791-#if __GLASGOW_HASKELL__>= 700
1792+#if __GLASGOW_HASKELL__ >= 700
1793 {-# INLINABLE minViewWithKey #-}
1794 #endif
1795 
1796hunk ./Data/IntMap.hs 1072
1797         Bin p m l r -> let (result,t') = minViewUnsigned l in (result,bin p m t' r)
1798         Tip k y -> ((k,y),Nil)
1799         Nil -> error "minViewUnsigned Nil"
1800-#if __GLASGOW_HASKELL__>= 700
1801+#if __GLASGOW_HASKELL__ >= 700
1802 {-# INLINABLE minViewUnsigned #-}
1803 #endif
1804 
1805hunk ./Data/IntMap.hs 1084
1806 
1807 updateMax :: (a -> a) -> IntMap a -> IntMap a
1808 updateMax f = updateMaxWithKey (const f)
1809-#if __GLASGOW_HASKELL__>= 700
1810+#if __GLASGOW_HASKELL__ >= 700
1811 {-# INLINABLE updateMax #-}
1812 #endif
1813 
1814hunk ./Data/IntMap.hs 1095
1815 
1816 updateMin :: (a -> a) -> IntMap a -> IntMap a
1817 updateMin f = updateMinWithKey (const f)
1818-#if __GLASGOW_HASKELL__>= 700
1819+#if __GLASGOW_HASKELL__ >= 700
1820 {-# INLINABLE updateMin #-}
1821 #endif
1822 
1823hunk ./Data/IntMap.hs 1102
1824 -- Similar to the Arrow instance.
1825 first :: (a -> c) -> (a, b) -> (c, b)
1826 first f (x,y) = (f x,y)
1827-#if __GLASGOW_HASKELL__>= 700
1828+#if __GLASGOW_HASKELL__ >= 700
1829 {-# INLINABLE first #-}
1830 #endif
1831 
1832hunk ./Data/IntMap.hs 1110
1833 -- stripped of that element, or 'Nothing' if passed an empty map.
1834 maxView :: IntMap a -> Maybe (a, IntMap a)
1835 maxView t = liftM (first snd) (maxViewWithKey t)
1836-#if __GLASGOW_HASKELL__>= 700
1837+#if __GLASGOW_HASKELL__ >= 700
1838 {-# INLINABLE maxView #-}
1839 #endif
1840 
1841hunk ./Data/IntMap.hs 1118
1842 -- stripped of that element, or 'Nothing' if passed an empty map.
1843 minView :: IntMap a -> Maybe (a, IntMap a)
1844 minView t = liftM (first snd) (minViewWithKey t)
1845-#if __GLASGOW_HASKELL__>= 700
1846+#if __GLASGOW_HASKELL__ >= 700
1847 {-# INLINABLE minView #-}
1848 #endif
1849 
1850hunk ./Data/IntMap.hs 1125
1851 -- | /O(log n)/. Delete and find the maximal element.
1852 deleteFindMax :: IntMap a -> (a, IntMap a)
1853 deleteFindMax = fromMaybe (error "deleteFindMax: empty map has no maximal element") . maxView
1854-#if __GLASGOW_HASKELL__>= 700
1855+#if __GLASGOW_HASKELL__ >= 700
1856 {-# INLINABLE deleteFindMax #-}
1857 #endif
1858 
1859hunk ./Data/IntMap.hs 1132
1860 -- | /O(log n)/. Delete and find the minimal element.
1861 deleteFindMin :: IntMap a -> (a, IntMap a)
1862 deleteFindMin = fromMaybe (error "deleteFindMin: empty map has no minimal element") . minView
1863-#if __GLASGOW_HASKELL__>= 700
1864+#if __GLASGOW_HASKELL__ >= 700
1865 {-# INLINABLE deleteFindMin #-}
1866 #endif
1867 
1868hunk ./Data/IntMap.hs 1146
1869     where go (Tip k v)      = (k,v)
1870           go (Bin _ _ l' _) = go l'
1871           go Nil            = error "findMax Nil"
1872-#if __GLASGOW_HASKELL__>= 700
1873+#if __GLASGOW_HASKELL__ >= 700
1874 {-# INLINABLE findMin #-}
1875 #endif
1876 
1877hunk ./Data/IntMap.hs 1160
1878     where go (Tip k v)      = (k,v)
1879           go (Bin _ _ _ r') = go r'
1880           go Nil            = error "findMax Nil"
1881-#if __GLASGOW_HASKELL__>= 700
1882+#if __GLASGOW_HASKELL__ >= 700
1883 {-# INLINABLE findMax #-}
1884 #endif
1885 
1886hunk ./Data/IntMap.hs 1168
1887 -- Note, this is not the same behavior Map.
1888 deleteMin :: IntMap a -> IntMap a
1889 deleteMin = maybe (error "deleteMin: empty map has no minimal element") snd . minView
1890-#if __GLASGOW_HASKELL__>= 700
1891+#if __GLASGOW_HASKELL__ >= 700
1892 {-# INLINABLE deleteMin #-}
1893 #endif
1894 
1895hunk ./Data/IntMap.hs 1176
1896 -- Note, this is not the same behavior Map.
1897 deleteMax :: IntMap a -> IntMap a
1898 deleteMax = maybe (error "deleteMax: empty map has no maximal element") snd . maxView
1899-#if __GLASGOW_HASKELL__>= 700
1900+#if __GLASGOW_HASKELL__ >= 700
1901 {-# INLINABLE deleteMax #-}
1902 #endif
1903 
1904hunk ./Data/IntMap.hs 1189
1905 isProperSubmapOf :: Eq a => IntMap a -> IntMap a -> Bool
1906 isProperSubmapOf m1 m2
1907   = isProperSubmapOfBy (==) m1 m2
1908-#if __GLASGOW_HASKELL__>= 700
1909+#if __GLASGOW_HASKELL__ >= 700
1910 {-# INLINABLE isProperSubmapOf #-}
1911 #endif
1912 
1913hunk ./Data/IntMap.hs 1214
1914   = case submapCmp predicate t1 t2 of
1915       LT -> True
1916       _  -> False
1917-#if __GLASGOW_HASKELL__>= 700
1918+#if __GLASGOW_HASKELL__ >= 700
1919 {-# INLINABLE isProperSubmapOfBy #-}
1920 #endif
1921 
1922hunk ./Data/IntMap.hs 1244
1923      _                      -> GT -- disjoint
1924 submapCmp _    Nil Nil = EQ
1925 submapCmp _    Nil _   = LT
1926-#if __GLASGOW_HASKELL__>= 700
1927+#if __GLASGOW_HASKELL__ >= 700
1928 {-# INLINABLE submapCmp #-}
1929 #endif
1930 
1931hunk ./Data/IntMap.hs 1253
1932 isSubmapOf :: Eq a => IntMap a -> IntMap a -> Bool
1933 isSubmapOf m1 m2
1934   = isSubmapOfBy (==) m1 m2
1935-#if __GLASGOW_HASKELL__>= 700
1936+#if __GLASGOW_HASKELL__ >= 700
1937 {-# INLINABLE isSubmapOf #-}
1938 #endif
1939 
1940hunk ./Data/IntMap.hs 1284
1941                                          Just y  -> predicate x y
1942                                          Nothing -> False
1943 isSubmapOfBy _         Nil _           = True
1944-#if __GLASGOW_HASKELL__>= 700
1945+#if __GLASGOW_HASKELL__ >= 700
1946 {-# INLINABLE isSubmapOfBy #-}
1947 #endif
1948 
1949hunk ./Data/IntMap.hs 1297
1950 
1951 map :: (a -> b) -> IntMap a -> IntMap b
1952 map f = mapWithKey (\_ x -> f x)
1953-#if __GLASGOW_HASKELL__>= 700
1954+#if __GLASGOW_HASKELL__ >= 700
1955 {-# INLINABLE map #-}
1956 #endif
1957 
1958hunk ./Data/IntMap.hs 1312
1959    go f (Bin p m l r) = Bin p m (go f l) (go f r)
1960    go f (Tip k x)     = Tip k (f k x)
1961    go f Nil           = Nil
1962-#if __GLASGOW_HASKELL__>= 700
1963+#if __GLASGOW_HASKELL__ >= 700
1964 {-# INLINABLE mapWithKey #-}
1965 #endif
1966 
1967hunk ./Data/IntMap.hs 1324
1968 
1969 mapAccum :: (a -> b -> (a,c)) -> a -> IntMap b -> (a,IntMap c)
1970 mapAccum f = mapAccumWithKey (\a' _ x -> f a' x)
1971-#if __GLASGOW_HASKELL__>= 700
1972+#if __GLASGOW_HASKELL__ >= 700
1973 {-# INLINABLE mapAccum #-}
1974 #endif
1975 
1976hunk ./Data/IntMap.hs 1337
1977 mapAccumWithKey :: (a -> Key -> b -> (a,c)) -> a -> IntMap b -> (a,IntMap c)
1978 mapAccumWithKey f a t
1979   = mapAccumL f a t
1980-#if __GLASGOW_HASKELL__>= 700
1981+#if __GLASGOW_HASKELL__ >= 700
1982 {-# INLINABLE mapAccumWithKey #-}
1983 #endif
1984 
1985hunk ./Data/IntMap.hs 1351
1986                      in (a2,Bin p m l' r')
1987       Tip k x     -> let (a',x') = f a k x in (a',Tip k x')
1988       Nil         -> (a,Nil)
1989-#if __GLASGOW_HASKELL__>= 700
1990+#if __GLASGOW_HASKELL__ >= 700
1991 {-# INLINABLE mapAccumL #-}
1992 #endif
1993 
1994hunk ./Data/IntMap.hs 1365
1995                      in (a2,Bin p m l' r')
1996       Tip k x     -> let (a',x') = f a k x in (a',Tip k x')
1997       Nil         -> (a,Nil)
1998-#if __GLASGOW_HASKELL__>= 700
1999+#if __GLASGOW_HASKELL__ >= 700
2000 {-# INLINABLE mapAccumRWithKey #-}
2001 #endif
2002 
2003hunk ./Data/IntMap.hs 1381
2004 filter :: (a -> Bool) -> IntMap a -> IntMap a
2005 filter p m
2006   = filterWithKey (\_ x -> p x) m
2007-#if __GLASGOW_HASKELL__>= 700
2008+#if __GLASGOW_HASKELL__ >= 700
2009 {-# INLINABLE filter #-}
2010 #endif
2011 
2012hunk ./Data/IntMap.hs 1397
2013         | p k x      = t
2014         | otherwise  = Nil
2015     go p Nil = Nil
2016-#if __GLASGOW_HASKELL__>= 700
2017+#if __GLASGOW_HASKELL__ >= 700
2018 {-# INLINABLE filterWithKey #-}
2019 #endif
2020 
2021hunk ./Data/IntMap.hs 1412
2022 partition :: (a -> Bool) -> IntMap a -> (IntMap a,IntMap a)
2023 partition p m
2024   = partitionWithKey (\_ x -> p x) m
2025-#if __GLASGOW_HASKELL__>= 700
2026+#if __GLASGOW_HASKELL__ >= 700
2027 {-# INLINABLE partition #-}
2028 #endif
2029 
2030hunk ./Data/IntMap.hs 1435
2031         | predicate k x -> (t,Nil)
2032         | otherwise     -> (Nil,t)
2033       Nil -> (Nil,Nil)
2034-#if __GLASGOW_HASKELL__>= 700
2035+#if __GLASGOW_HASKELL__ >= 700
2036 {-# INLINABLE partitionWithKey #-}
2037 #endif
2038 
2039hunk ./Data/IntMap.hs 1446
2040 
2041 mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b
2042 mapMaybe f = mapMaybeWithKey (\_ x -> f x)
2043-#if __GLASGOW_HASKELL__>= 700
2044+#if __GLASGOW_HASKELL__ >= 700
2045 {-# INLINABLE mapMaybe #-}
2046 #endif
2047 
2048hunk ./Data/IntMap.hs 1463
2049                           Just y  -> Tip k y
2050                           Nothing -> Nil
2051     go f Nil = Nil
2052-#if __GLASGOW_HASKELL__>= 700
2053+#if __GLASGOW_HASKELL__ >= 700
2054 {-# INLINABLE mapMaybeWithKey #-}
2055 #endif
2056 
2057hunk ./Data/IntMap.hs 1479
2058 mapEither :: (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
2059 mapEither f m
2060   = mapEitherWithKey (\_ x -> f x) m
2061-#if __GLASGOW_HASKELL__>= 700
2062+#if __GLASGOW_HASKELL__ >= 700
2063 {-# INLINABLE mapEither #-}
2064 #endif
2065 
2066hunk ./Data/IntMap.hs 1502
2067   Left y  -> (Tip k y, Nil)
2068   Right z -> (Nil, Tip k z)
2069 mapEitherWithKey _ Nil = (Nil, Nil)
2070-#if __GLASGOW_HASKELL__>= 700
2071+#if __GLASGOW_HASKELL__ >= 700
2072 {-# INLINABLE mapEitherWithKey #-}
2073 #endif
2074 
2075hunk ./Data/IntMap.hs 1529
2076         | k<ky      -> (Nil,t)
2077         | otherwise -> (Nil,Nil)
2078       Nil -> (Nil,Nil)
2079-#if __GLASGOW_HASKELL__>= 700
2080+#if __GLASGOW_HASKELL__ >= 700
2081 {-# INLINABLE split #-}
2082 #endif
2083 
2084hunk ./Data/IntMap.hs 1545
2085         | k<ky      -> (Nil,t)
2086         | otherwise -> (Nil,Nil)
2087       Nil -> (Nil,Nil)
2088-#if __GLASGOW_HASKELL__>= 700
2089+#if __GLASGOW_HASKELL__ >= 700
2090 {-# INLINABLE split' #-}
2091 #endif
2092 
2093hunk ./Data/IntMap.hs 1571
2094         | k<ky      -> (Nil,Nothing,t)
2095         | otherwise -> (Nil,Just y,Nil)
2096       Nil -> (Nil,Nothing,Nil)
2097-#if __GLASGOW_HASKELL__>= 700
2098+#if __GLASGOW_HASKELL__ >= 700
2099 {-# INLINABLE splitLookup #-}
2100 #endif
2101 
2102hunk ./Data/IntMap.hs 1587
2103         | k<ky      -> (Nil,Nothing,t)
2104         | otherwise -> (Nil,Just y,Nil)
2105       Nil -> (Nil,Nothing,Nil)
2106-#if __GLASGOW_HASKELL__>= 700
2107+#if __GLASGOW_HASKELL__ >= 700
2108 {-# INLINABLE splitLookup' #-}
2109 #endif
2110 
2111hunk ./Data/IntMap.hs 1605
2112 
2113 fold :: (a -> b -> b) -> b -> IntMap a -> b
2114 fold f = foldWithKey (\_ x y -> f x y)
2115-#if __GLASGOW_HASKELL__>= 700
2116+#if __GLASGOW_HASKELL__ >= 700
2117 {-# INLINABLE fold #-}
2118 #endif
2119 
2120hunk ./Data/IntMap.hs 1621
2121 foldWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
2122 foldWithKey
2123   = foldr
2124-#if __GLASGOW_HASKELL__>= 700
2125+#if __GLASGOW_HASKELL__ >= 700
2126 {-# INLINABLE foldWithKey #-}
2127 #endif
2128 
2129hunk ./Data/IntMap.hs 1632
2130       Bin _ _ _ _ -> foldr' f z t
2131       Tip k x     -> f k x z
2132       Nil         -> z
2133-#if __GLASGOW_HASKELL__>= 700
2134+#if __GLASGOW_HASKELL__ >= 700
2135 {-# INLINABLE foldr #-}
2136 #endif
2137 
2138hunk ./Data/IntMap.hs 1642
2139     go f z (Bin _ _ l r) = go f (go f z r) l
2140     go f z (Tip k x)     = f k x z
2141     go f z Nil           = z
2142-#if __GLASGOW_HASKELL__>= 700
2143+#if __GLASGOW_HASKELL__ >= 700
2144 {-# INLINABLE foldr' #-}
2145 #endif
2146 
2147hunk ./Data/IntMap.hs 1658
2148 elems :: IntMap a -> [a]
2149 elems
2150   = foldWithKey (\_ x xs -> x:xs) []
2151-#if __GLASGOW_HASKELL__>= 700
2152+#if __GLASGOW_HASKELL__ >= 700
2153 {-# INLINABLE elems #-}
2154 #endif
2155 
2156hunk ./Data/IntMap.hs 1670
2157 keys  :: IntMap a -> [Key]
2158 keys
2159   = foldWithKey (\k _ ks -> k:ks) []
2160-#if __GLASGOW_HASKELL__>= 700
2161+#if __GLASGOW_HASKELL__ >= 700
2162 {-# INLINABLE keys  #-}
2163 #endif
2164 
2165hunk ./Data/IntMap.hs 1681
2166 
2167 keysSet :: IntMap a -> IntSet.IntSet
2168 keysSet m = IntSet.fromDistinctAscList (keys m)
2169-#if __GLASGOW_HASKELL__>= 700
2170+#if __GLASGOW_HASKELL__ >= 700
2171 {-# INLINABLE keysSet #-}
2172 #endif
2173 
2174hunk ./Data/IntMap.hs 1694
2175 assocs :: IntMap a -> [(Key,a)]
2176 assocs m
2177   = toList m
2178-#if __GLASGOW_HASKELL__>= 700
2179+#if __GLASGOW_HASKELL__ >= 700
2180 {-# INLINABLE assocs #-}
2181 #endif
2182 
2183hunk ./Data/IntMap.hs 1710
2184 toList :: IntMap a -> [(Key,a)]
2185 toList
2186   = foldWithKey (\k x xs -> (k,x):xs) []
2187-#if __GLASGOW_HASKELL__>= 700
2188+#if __GLASGOW_HASKELL__ >= 700
2189 {-# INLINABLE toList #-}
2190 #endif
2191 
2192hunk ./Data/IntMap.hs 1723
2193 toAscList t   
2194   = -- NOTE: the following algorithm only works for big-endian trees
2195     let (pos,neg) = span (\(k,_) -> k >=0) (foldr (\k x xs -> (k,x):xs) [] t) in neg ++ pos
2196-#if __GLASGOW_HASKELL__>= 700
2197+#if __GLASGOW_HASKELL__ >= 700
2198 {-# INLINABLE toAscList #-}
2199 #endif
2200 
2201hunk ./Data/IntMap.hs 1738
2202   = foldlStrict ins empty xs
2203   where
2204     ins t (k,x)  = insert k x t
2205-#if __GLASGOW_HASKELL__>= 700
2206+#if __GLASGOW_HASKELL__ >= 700
2207 {-# INLINABLE fromList #-}
2208 #endif
2209 
2210hunk ./Data/IntMap.hs 1750
2211 fromListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a
2212 fromListWith f xs
2213   = fromListWithKey (\_ x y -> f x y) xs
2214-#if __GLASGOW_HASKELL__>= 700
2215+#if __GLASGOW_HASKELL__ >= 700
2216 {-# INLINABLE fromListWith #-}
2217 #endif
2218 
2219hunk ./Data/IntMap.hs 1764
2220   = foldlStrict ins empty xs
2221   where
2222     ins t (k,x) = insertWithKey f k x t
2223-#if __GLASGOW_HASKELL__>= 700
2224+#if __GLASGOW_HASKELL__ >= 700
2225 {-# INLINABLE fromListWithKey #-}
2226 #endif
2227 
2228hunk ./Data/IntMap.hs 1777
2229 fromAscList :: [(Key,a)] -> IntMap a
2230 fromAscList xs
2231   = fromAscListWithKey (\_ x _ -> x) xs
2232-#if __GLASGOW_HASKELL__>= 700
2233+#if __GLASGOW_HASKELL__ >= 700
2234 {-# INLINABLE fromAscList #-}
2235 #endif
2236 
2237hunk ./Data/IntMap.hs 1790
2238 fromAscListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a
2239 fromAscListWith f xs
2240   = fromAscListWithKey (\_ x y -> f x y) xs
2241-#if __GLASGOW_HASKELL__>= 700
2242+#if __GLASGOW_HASKELL__ >= 700
2243 {-# INLINABLE fromAscListWith #-}
2244 #endif
2245 
2246hunk ./Data/IntMap.hs 1809
2247     combineEq z@(kz,zz) (x@(kx,xx):xs)
2248       | kx==kz    = let yy = f kx xx zz in combineEq (kx,yy) xs
2249       | otherwise = z:combineEq x xs
2250-#if __GLASGOW_HASKELL__>= 700
2251+#if __GLASGOW_HASKELL__ >= 700
2252 {-# INLINABLE fromAscListWithKey #-}
2253 #endif
2254 
2255hunk ./Data/IntMap.hs 1845
2256     finish px tx (Push py ty stk) = finish p (join py ty px tx) stk
2257         where m = branchMask px py
2258               p = mask px m
2259-#if __GLASGOW_HASKELL__>= 700
2260+#if __GLASGOW_HASKELL__ >= 700
2261 {-# INLINABLE fromDistinctAscList #-}
2262 #endif
2263 
2264hunk ./Data/IntMap.hs 1866
2265   = (kx == ky) && (x==y)
2266 equal Nil Nil = True
2267 equal _   _   = False
2268-#if __GLASGOW_HASKELL__>= 700
2269+#if __GLASGOW_HASKELL__ >= 700
2270 {-# INLINABLE equal #-}
2271 #endif
2272 
2273hunk ./Data/IntMap.hs 1877
2274   = (kx /= ky) || (x/=y)
2275 nequal Nil Nil = False
2276 nequal _   _   = True
2277-#if __GLASGOW_HASKELL__>= 700
2278+#if __GLASGOW_HASKELL__ >= 700
2279 {-# INLINABLE nequal #-}
2280 #endif
2281 
2282hunk ./Data/IntMap.hs 2025
2283   where
2284     m = branchMask p1 p2
2285     p = mask p1 m
2286-#if __GLASGOW_HASKELL__>= 700
2287+#if __GLASGOW_HASKELL__ >= 700
2288 {-# INLINABLE join #-}
2289 #endif
2290 
2291hunk ./Data/IntMap.hs 2036
2292 bin _ _ l Nil = l
2293 bin _ _ Nil r = r
2294 bin p m l r   = Bin p m l r
2295-#if __GLASGOW_HASKELL__>= 700
2296+#if __GLASGOW_HASKELL__ >= 700
2297 {-# INLINABLE bin #-}
2298 #endif
2299 
2300hunk ./Data/IntMap.hs 2047
2301 zero :: Key -> Mask -> Bool
2302 zero i m
2303   = (natFromInt i) .&. (natFromInt m) == 0
2304-#if __GLASGOW_HASKELL__>= 700
2305+#if __GLASGOW_HASKELL__ >= 700
2306 {-# INLINABLE zero #-}
2307 #endif
2308 
2309hunk ./Data/IntMap.hs 2054
2310 nomatch,match :: Key -> Prefix -> Mask -> Bool
2311 nomatch i p m
2312   = (mask i m) /= p
2313-#if __GLASGOW_HASKELL__>= 700
2314+#if __GLASGOW_HASKELL__ >= 700
2315 {-# INLINABLE nomatch #-}
2316 #endif
2317 
2318hunk ./Data/IntMap.hs 2060
2319 match i p m
2320   = (mask i m) == p
2321-#if __GLASGOW_HASKELL__>= 700
2322+#if __GLASGOW_HASKELL__ >= 700
2323 {-# INLINABLE match #-}
2324 #endif
2325 
2326hunk ./Data/IntMap.hs 2067
2327 mask :: Key -> Mask -> Prefix
2328 mask i m
2329   = maskW (natFromInt i) (natFromInt m)
2330-#if __GLASGOW_HASKELL__>= 700
2331+#if __GLASGOW_HASKELL__ >= 700
2332 {-# INLINABLE mask #-}
2333 #endif
2334 
2335hunk ./Data/IntMap.hs 2078
2336 maskW :: Nat -> Nat -> Prefix
2337 maskW i m
2338   = intFromNat (i .&. (complement (m-1) `xor` m))
2339-#if __GLASGOW_HASKELL__>= 700
2340+#if __GLASGOW_HASKELL__ >= 700
2341 {-# INLINABLE maskW #-}
2342 #endif
2343 
2344hunk ./Data/IntMap.hs 2085
2345 shorter :: Mask -> Mask -> Bool
2346 shorter m1 m2
2347   = (natFromInt m1) > (natFromInt m2)
2348-#if __GLASGOW_HASKELL__>= 700
2349+#if __GLASGOW_HASKELL__ >= 700
2350 {-# INLINABLE shorter #-}
2351 #endif
2352 
2353hunk ./Data/IntMap.hs 2092
2354 branchMask :: Prefix -> Prefix -> Mask
2355 branchMask p1 p2
2356   = intFromNat (highestBitMask (natFromInt p1 `xor` natFromInt p2))
2357-#if __GLASGOW_HASKELL__>= 700
2358+#if __GLASGOW_HASKELL__ >= 700
2359 {-# INLINABLE branchMask #-}
2360 #endif
2361 
2362hunk ./Data/IntMap.hs 2147
2363         x4 -> case (x4 .|. shiftRL x4 16) of
2364          x5 -> case (x5 .|. shiftRL x5 32) of   -- for 64 bit platforms
2365           x6 -> (x6 `xor` (shiftRL x6 1))
2366-#if __GLASGOW_HASKELL__>= 700
2367+#if __GLASGOW_HASKELL__ >= 700
2368 {-# INLINABLE highestBitMask #-}
2369 #endif
2370 
2371hunk ./Data/IntMap.hs 2162
2372     STRICT23(go)
2373     go f z []     = z
2374     go f z (x:xs) = go f (f z x) xs
2375-#if __GLASGOW_HASKELL__>= 700
2376+#if __GLASGOW_HASKELL__ >= 700
2377 {-# INLINABLE foldlStrict #-}
2378 #endif
2379hunk ./Data/IntSet.hs 147
2380 
2381 natFromInt :: Int -> Nat
2382 natFromInt i = fromIntegral i
2383-#if __GLASGOW_HASKELL__>= 700
2384+#if __GLASGOW_HASKELL__ >= 700
2385 {-# INLINABLE natFromInt #-}
2386 #endif
2387 
2388hunk ./Data/IntSet.hs 153
2389 intFromNat :: Nat -> Int
2390 intFromNat w = fromIntegral w
2391-#if __GLASGOW_HASKELL__>= 700
2392+#if __GLASGOW_HASKELL__ >= 700
2393 {-# INLINABLE intFromNat #-}
2394 #endif
2395 
2396hunk ./Data/IntSet.hs 167
2397 #else
2398 shiftRL x i   = shiftR x i
2399 #endif
2400-#if __GLASGOW_HASKELL__>= 700
2401+#if __GLASGOW_HASKELL__ >= 700
2402 {-# INLINABLE shiftRL #-}
2403 #endif
2404 
2405hunk ./Data/IntSet.hs 177
2406 -- | /O(n+m)/. See 'difference'.
2407 (\\) :: IntSet -> IntSet -> IntSet
2408 m1 \\ m2 = difference m1 m2
2409-#if __GLASGOW_HASKELL__>= 700
2410+#if __GLASGOW_HASKELL__ >= 700
2411 {-# INLINABLE (\\) #-}
2412 #endif
2413 
2414hunk ./Data/IntSet.hs 229
2415 null :: IntSet -> Bool
2416 null Nil = True
2417 null _   = False
2418-#if __GLASGOW_HASKELL__>= 700
2419+#if __GLASGOW_HASKELL__ >= 700
2420 {-# INLINABLE null #-}
2421 #endif
2422 
2423hunk ./Data/IntSet.hs 240
2424       Bin _ _ l r -> size l + size r
2425       Tip _ -> 1
2426       Nil   -> 0
2427-#if __GLASGOW_HASKELL__>= 700
2428+#if __GLASGOW_HASKELL__ >= 700
2429 {-# INLINABLE size #-}
2430 #endif
2431 
2432hunk ./Data/IntSet.hs 254
2433           | otherwise     = go x r
2434         go x (Tip y) = x == y
2435         go _ Nil = False
2436-#if __GLASGOW_HASKELL__>= 700
2437+#if __GLASGOW_HASKELL__ >= 700
2438 {-# INLINABLE member #-}
2439 #endif
2440 
2441hunk ./Data/IntSet.hs 261
2442 -- | /O(min(n,W))/. Is the element not in the set?
2443 notMember :: Int -> IntSet -> Bool
2444 notMember k = not . member k
2445-#if __GLASGOW_HASKELL__>= 700
2446+#if __GLASGOW_HASKELL__ >= 700
2447 {-# INLINABLE notMember #-}
2448 #endif
2449 
2450hunk ./Data/IntSet.hs 276
2451           | k == kx   = Just kx
2452           | otherwise = Nothing
2453         go _ Nil = Nothing
2454-#if __GLASGOW_HASKELL__>= 700
2455+#if __GLASGOW_HASKELL__ >= 700
2456 {-# INLINABLE lookup #-}
2457 #endif
2458 
2459hunk ./Data/IntSet.hs 287
2460 empty :: IntSet
2461 empty
2462   = Nil
2463-#if __GLASGOW_HASKELL__>= 700
2464+#if __GLASGOW_HASKELL__ >= 700
2465 {-# INLINABLE empty #-}
2466 #endif
2467 
2468hunk ./Data/IntSet.hs 295
2469 singleton :: Int -> IntSet
2470 singleton x
2471   = Tip x
2472-#if __GLASGOW_HASKELL__>= 700
2473+#if __GLASGOW_HASKELL__ >= 700
2474 {-# INLINABLE singleton #-}
2475 #endif
2476 
2477hunk ./Data/IntSet.hs 316
2478           | x==y          = Tip x
2479           | otherwise     = join x (Tip x) y t
2480         go x Nil            = Tip x
2481-#if __GLASGOW_HASKELL__>= 700
2482+#if __GLASGOW_HASKELL__ >= 700
2483 {-# INLINABLE insert #-}
2484 #endif
2485 
2486hunk ./Data/IntSet.hs 332
2487           | x==y          = t
2488           | otherwise     = join x (Tip x) y t
2489         go x Nil            = Tip x
2490-#if __GLASGOW_HASKELL__>= 700
2491+#if __GLASGOW_HASKELL__ >= 700
2492 {-# INLINABLE insertR #-}
2493 #endif
2494 
2495hunk ./Data/IntSet.hs 349
2496           | x==y          = Nil
2497           | otherwise     = t
2498         go _ t@Nil          = t
2499-#if __GLASGOW_HASKELL__>= 700
2500+#if __GLASGOW_HASKELL__ >= 700
2501 {-# INLINABLE delete #-}
2502 #endif
2503 
2504hunk ./Data/IntSet.hs 360
2505 unions :: [IntSet] -> IntSet
2506 unions xs
2507   = foldlStrict union empty xs
2508-#if __GLASGOW_HASKELL__>= 700
2509+#if __GLASGOW_HASKELL__ >= 700
2510 {-# INLINABLE unions #-}
2511 #endif
2512 
2513hunk ./Data/IntSet.hs 385
2514 union t (Tip x) = insertR x t  -- right bias
2515 union Nil t     = t
2516 union t Nil     = t
2517-#if __GLASGOW_HASKELL__>= 700
2518+#if __GLASGOW_HASKELL__ >= 700
2519 {-# INLINABLE union #-}
2520 #endif
2521 
2522hunk ./Data/IntSet.hs 416
2523 difference Nil _     = Nil
2524 difference t (Tip x) = delete x t
2525 difference t Nil     = t
2526-#if __GLASGOW_HASKELL__>= 700
2527+#if __GLASGOW_HASKELL__ >= 700
2528 {-# INLINABLE difference #-}
2529 #endif
2530 
2531hunk ./Data/IntSet.hs 450
2532       Nothing -> Nil
2533 intersection Nil _ = Nil
2534 intersection _ Nil = Nil
2535-#if __GLASGOW_HASKELL__>= 700
2536+#if __GLASGOW_HASKELL__ >= 700
2537 {-# INLINABLE intersection #-}
2538 #endif
2539 
2540hunk ./Data/IntSet.hs 465
2541   = case subsetCmp t1 t2 of
2542       LT -> True
2543       _  -> False
2544-#if __GLASGOW_HASKELL__>= 700
2545+#if __GLASGOW_HASKELL__ >= 700
2546 {-# INLINABLE isProperSubsetOf #-}
2547 #endif
2548 
2549hunk ./Data/IntSet.hs 496
2550   | otherwise  = GT  -- disjoint
2551 subsetCmp Nil Nil = EQ
2552 subsetCmp Nil _   = LT
2553-#if __GLASGOW_HASKELL__>= 700
2554+#if __GLASGOW_HASKELL__ >= 700
2555 {-# INLINABLE subsetCmp #-}
2556 #endif
2557 
2558hunk ./Data/IntSet.hs 512
2559 isSubsetOf (Bin _ _ _ _) _  = False
2560 isSubsetOf (Tip x) t        = member x t
2561 isSubsetOf Nil _            = True
2562-#if __GLASGOW_HASKELL__>= 700
2563+#if __GLASGOW_HASKELL__ >= 700
2564 {-# INLINABLE isSubsetOf #-}
2565 #endif
2566 
2567hunk ./Data/IntSet.hs 530
2568         | predicate x -> t
2569         | otherwise   -> Nil
2570       Nil -> Nil
2571-#if __GLASGOW_HASKELL__>= 700
2572+#if __GLASGOW_HASKELL__ >= 700
2573 {-# INLINABLE filter #-}
2574 #endif
2575 
2576hunk ./Data/IntSet.hs 546
2577         | predicate x -> (t,Nil)
2578         | otherwise   -> (Nil,t)
2579       Nil -> (Nil,Nil)
2580-#if __GLASGOW_HASKELL__>= 700
2581+#if __GLASGOW_HASKELL__ >= 700
2582 {-# INLINABLE partition #-}
2583 #endif
2584 
2585hunk ./Data/IntSet.hs 569
2586         | x<y         -> (Nil,t)
2587         | otherwise   -> (Nil,Nil)
2588       Nil             -> (Nil, Nil)
2589-#if __GLASGOW_HASKELL__>= 700
2590+#if __GLASGOW_HASKELL__ >= 700
2591 {-# INLINABLE split #-}
2592 #endif
2593 
2594hunk ./Data/IntSet.hs 586
2595         | x<y       -> (Nil,t)
2596         | otherwise -> (Nil,Nil)
2597       Nil -> (Nil,Nil)
2598-#if __GLASGOW_HASKELL__>= 700
2599+#if __GLASGOW_HASKELL__ >= 700
2600 {-# INLINABLE split' #-}
2601 #endif
2602 
2603hunk ./Data/IntSet.hs 605
2604         | x<y       -> (Nil,False,t)
2605         | otherwise -> (Nil,True,Nil)
2606       Nil -> (Nil,False,Nil)
2607-#if __GLASGOW_HASKELL__>= 700
2608+#if __GLASGOW_HASKELL__ >= 700
2609 {-# INLINABLE splitMember #-}
2610 #endif
2611 
2612hunk ./Data/IntSet.hs 622
2613         | x<y       -> (Nil,False,t)
2614         | otherwise -> (Nil,True,Nil)
2615       Nil -> (Nil,False,Nil)
2616-#if __GLASGOW_HASKELL__>= 700
2617+#if __GLASGOW_HASKELL__ >= 700
2618 {-# INLINABLE splitMember' #-}
2619 #endif
2620 
2621hunk ./Data/IntSet.hs 639
2622         Bin p m l r         -> let (result,t') = maxViewUnsigned r in Just (result, bin p m l t')           
2623         Tip y -> Just (y,Nil)
2624         Nil -> Nothing
2625-#if __GLASGOW_HASKELL__>= 700
2626+#if __GLASGOW_HASKELL__ >= 700
2627 {-# INLINABLE maxView #-}
2628 #endif
2629 
2630hunk ./Data/IntSet.hs 649
2631         Bin p m l r -> let (result,t') = maxViewUnsigned r in (result, bin p m l t')
2632         Tip y -> (y, Nil)
2633         Nil -> error "maxViewUnsigned Nil"
2634-#if __GLASGOW_HASKELL__>= 700
2635+#if __GLASGOW_HASKELL__ >= 700
2636 {-# INLINABLE maxViewUnsigned #-}
2637 #endif
2638 
2639hunk ./Data/IntSet.hs 662
2640         Bin p m l r         -> let (result,t') = minViewUnsigned l in Just (result, bin p m t' r)
2641         Tip y -> Just (y, Nil)
2642         Nil -> Nothing
2643-#if __GLASGOW_HASKELL__>= 700
2644+#if __GLASGOW_HASKELL__ >= 700
2645 {-# INLINABLE minView #-}
2646 #endif
2647 
2648hunk ./Data/IntSet.hs 672
2649         Bin p m l r -> let (result,t') = minViewUnsigned l in (result, bin p m t' r)
2650         Tip y -> (y, Nil)
2651         Nil -> error "minViewUnsigned Nil"
2652-#if __GLASGOW_HASKELL__>= 700
2653+#if __GLASGOW_HASKELL__ >= 700
2654 {-# INLINABLE minViewUnsigned #-}
2655 #endif
2656 
2657hunk ./Data/IntSet.hs 681
2658 -- > deleteFindMin set = (findMin set, deleteMin set)
2659 deleteFindMin :: IntSet -> (Int, IntSet)
2660 deleteFindMin = fromMaybe (error "deleteFindMin: empty set has no minimal element") . minView
2661-#if __GLASGOW_HASKELL__>= 700
2662+#if __GLASGOW_HASKELL__ >= 700
2663 {-# INLINABLE deleteFindMin #-}
2664 #endif
2665 
2666hunk ./Data/IntSet.hs 690
2667 -- > deleteFindMax set = (findMax set, deleteMax set)
2668 deleteFindMax :: IntSet -> (Int, IntSet)
2669 deleteFindMax = fromMaybe (error "deleteFindMax: empty set has no maximal element") . maxView
2670-#if __GLASGOW_HASKELL__>= 700
2671+#if __GLASGOW_HASKELL__ >= 700
2672 {-# INLINABLE deleteFindMax #-}
2673 #endif
2674 
2675hunk ./Data/IntSet.hs 705
2676     where find (Tip x)        = x
2677           find (Bin _ _ l' _) = find l'
2678           find Nil            = error "findMin Nil"
2679-#if __GLASGOW_HASKELL__>= 700
2680+#if __GLASGOW_HASKELL__ >= 700
2681 {-# INLINABLE findMin #-}
2682 #endif
2683 
2684hunk ./Data/IntSet.hs 719
2685     where find (Tip x)        = x
2686           find (Bin _ _ _ r') = find r'
2687           find Nil            = error "findMax Nil"
2688-#if __GLASGOW_HASKELL__>= 700
2689+#if __GLASGOW_HASKELL__ >= 700
2690 {-# INLINABLE findMax #-}
2691 #endif
2692 
2693hunk ./Data/IntSet.hs 727
2694 -- | /O(min(n,W))/. Delete the minimal element.
2695 deleteMin :: IntSet -> IntSet
2696 deleteMin = maybe (error "deleteMin: empty set has no minimal element") snd . minView
2697-#if __GLASGOW_HASKELL__>= 700
2698+#if __GLASGOW_HASKELL__ >= 700
2699 {-# INLINABLE deleteMin #-}
2700 #endif
2701 
2702hunk ./Data/IntSet.hs 734
2703 -- | /O(min(n,W))/. Delete the maximal element.
2704 deleteMax :: IntSet -> IntSet
2705 deleteMax = maybe (error "deleteMax: empty set has no maximal element") snd . maxView
2706-#if __GLASGOW_HASKELL__>= 700
2707+#if __GLASGOW_HASKELL__ >= 700
2708 {-# INLINABLE deleteMax #-}
2709 #endif
2710 
2711hunk ./Data/IntSet.hs 750
2712 
2713 map :: (Int->Int) -> IntSet -> IntSet
2714 map f = fromList . List.map f . toList
2715-#if __GLASGOW_HASKELL__>= 700
2716+#if __GLASGOW_HASKELL__ >= 700
2717 {-# INLINABLE map #-}
2718 #endif
2719 
2720hunk ./Data/IntSet.hs 769
2721       Bin _ _ _ _ -> foldr f z t
2722       Tip x       -> f x z
2723       Nil         -> z
2724-#if __GLASGOW_HASKELL__>= 700
2725+#if __GLASGOW_HASKELL__ >= 700
2726 {-# INLINABLE fold #-}
2727 #endif
2728 
2729hunk ./Data/IntSet.hs 779
2730       Bin _ _ l r -> foldr f (foldr f z r) l
2731       Tip x       -> f x z
2732       Nil         -> z
2733-#if __GLASGOW_HASKELL__>= 700
2734+#if __GLASGOW_HASKELL__ >= 700
2735 {-# INLINABLE foldr #-}
2736 #endif
2737 
2738hunk ./Data/IntSet.hs 790
2739 elems :: IntSet -> [Int]
2740 elems s
2741   = toList s
2742-#if __GLASGOW_HASKELL__>= 700
2743+#if __GLASGOW_HASKELL__ >= 700
2744 {-# INLINABLE elems #-}
2745 #endif
2746 
2747hunk ./Data/IntSet.hs 801
2748 toList :: IntSet -> [Int]
2749 toList t
2750   = fold (:) [] t
2751-#if __GLASGOW_HASKELL__>= 700
2752+#if __GLASGOW_HASKELL__ >= 700
2753 {-# INLINABLE toList #-}
2754 #endif
2755 
2756hunk ./Data/IntSet.hs 808
2757 -- | /O(n)/. Convert the set to an ascending list of elements.
2758 toAscList :: IntSet -> [Int]
2759 toAscList t = toList t
2760-#if __GLASGOW_HASKELL__>= 700
2761+#if __GLASGOW_HASKELL__ >= 700
2762 {-# INLINABLE toAscList #-}
2763 #endif
2764 
2765hunk ./Data/IntSet.hs 818
2766   = foldlStrict ins empty xs
2767   where
2768     ins t x  = insert x t
2769-#if __GLASGOW_HASKELL__>= 700
2770+#if __GLASGOW_HASKELL__ >= 700
2771 {-# INLINABLE fromList #-}
2772 #endif
2773 
2774hunk ./Data/IntSet.hs 832
2775     combineEq x' (x:xs)
2776       | x==x'     = combineEq x' xs
2777       | otherwise = x' : combineEq x xs
2778-#if __GLASGOW_HASKELL__>= 700
2779+#if __GLASGOW_HASKELL__ >= 700
2780 {-# INLINABLE fromAscList #-}
2781 #endif
2782 
2783hunk ./Data/IntSet.hs 857
2784     finish px tx (Push py ty stk) = finish p (join py ty px tx) stk
2785         where m = branchMask px py
2786               p = mask px m
2787-#if __GLASGOW_HASKELL__>= 700
2788+#if __GLASGOW_HASKELL__ >= 700
2789 {-# INLINABLE fromDistinctAscList #-}
2790 #endif
2791 
2792hunk ./Data/IntSet.hs 878
2793   = (x==y)
2794 equal Nil Nil = True
2795 equal _   _   = False
2796-#if __GLASGOW_HASKELL__>= 700
2797+#if __GLASGOW_HASKELL__ >= 700
2798 {-# INLINABLE equal #-}
2799 #endif
2800 
2801hunk ./Data/IntSet.hs 889
2802   = (x/=y)
2803 nequal Nil Nil = False
2804 nequal _   _   = True
2805-#if __GLASGOW_HASKELL__>= 700
2806+#if __GLASGOW_HASKELL__ >= 700
2807 {-# INLINABLE nequal #-}
2808 #endif
2809 
2810hunk ./Data/IntSet.hs 1027
2811   where
2812     m = branchMask p1 p2
2813     p = mask p1 m
2814-#if __GLASGOW_HASKELL__>= 700
2815+#if __GLASGOW_HASKELL__ >= 700
2816 {-# INLINABLE join #-}
2817 #endif
2818 
2819hunk ./Data/IntSet.hs 1038
2820 bin _ _ l Nil = l
2821 bin _ _ Nil r = r
2822 bin p m l r   = Bin p m l r
2823-#if __GLASGOW_HASKELL__>= 700
2824+#if __GLASGOW_HASKELL__ >= 700
2825 {-# INLINABLE bin #-}
2826 #endif
2827 
2828hunk ./Data/IntSet.hs 1049
2829 zero :: Int -> Mask -> Bool
2830 zero i m
2831   = (natFromInt i) .&. (natFromInt m) == 0
2832-#if __GLASGOW_HASKELL__>= 700
2833+#if __GLASGOW_HASKELL__ >= 700
2834 {-# INLINABLE zero #-}
2835 #endif
2836 
2837hunk ./Data/IntSet.hs 1056
2838 nomatch,match :: Int -> Prefix -> Mask -> Bool
2839 nomatch i p m
2840   = (mask i m) /= p
2841-#if __GLASGOW_HASKELL__>= 700
2842+#if __GLASGOW_HASKELL__ >= 700
2843 {-# INLINABLE nomatch #-}
2844 #endif
2845 
2846hunk ./Data/IntSet.hs 1062
2847 match i p m
2848   = (mask i m) == p
2849-#if __GLASGOW_HASKELL__>= 700
2850+#if __GLASGOW_HASKELL__ >= 700
2851 {-# INLINABLE match #-}
2852 #endif
2853 
2854hunk ./Data/IntSet.hs 1071
2855 mask :: Int -> Mask -> Prefix
2856 mask i m
2857   = maskW (natFromInt i) (natFromInt m)
2858-#if __GLASGOW_HASKELL__>= 700
2859+#if __GLASGOW_HASKELL__ >= 700
2860 {-# INLINABLE mask #-}
2861 #endif
2862 
2863hunk ./Data/IntSet.hs 1081
2864 maskW :: Nat -> Nat -> Prefix
2865 maskW i m
2866   = intFromNat (i .&. (complement (m-1) `xor` m))
2867-#if __GLASGOW_HASKELL__>= 700
2868+#if __GLASGOW_HASKELL__ >= 700
2869 {-# INLINABLE maskW #-}
2870 #endif
2871 
2872hunk ./Data/IntSet.hs 1088
2873 shorter :: Mask -> Mask -> Bool
2874 shorter m1 m2
2875   = (natFromInt m1) > (natFromInt m2)
2876-#if __GLASGOW_HASKELL__>= 700
2877+#if __GLASGOW_HASKELL__ >= 700
2878 {-# INLINABLE shorter #-}
2879 #endif
2880 
2881hunk ./Data/IntSet.hs 1095
2882 branchMask :: Prefix -> Prefix -> Mask
2883 branchMask p1 p2
2884   = intFromNat (highestBitMask (natFromInt p1 `xor` natFromInt p2))
2885-#if __GLASGOW_HASKELL__>= 700
2886+#if __GLASGOW_HASKELL__ >= 700
2887 {-# INLINABLE branchMask #-}
2888 #endif
2889 
2890hunk ./Data/IntSet.hs 1150
2891         x4 -> case (x4 .|. shiftRL x4 16) of
2892          x5 -> case (x5 .|. shiftRL x5 32) of   -- for 64 bit platforms
2893           x6 -> (x6 `xor` (shiftRL x6 1))
2894-#if __GLASGOW_HASKELL__>= 700
2895+#if __GLASGOW_HASKELL__ >= 700
2896 {-# INLINABLE highestBitMask #-}
2897 #endif
2898 
2899hunk ./Data/IntSet.hs 1164
2900     STRICT23(go)
2901     go f z []     = z
2902     go f z (x:xs) = go f (f z x) xs
2903-#if __GLASGOW_HASKELL__>= 700
2904+#if __GLASGOW_HASKELL__ >= 700
2905 {-# INLINABLE foldlStrict #-}
2906 #endif
2907hunk ./Data/Map.hs 231
2908 
2909 (!) :: Ord k => Map k a -> k -> a
2910 m ! k    = find k m
2911-#if __GLASGOW_HASKELL__>= 700
2912+#if __GLASGOW_HASKELL__ >= 700
2913 {-# INLINABLE (!) #-}
2914 #endif
2915 
2916hunk ./Data/Map.hs 238
2917 -- | Same as 'difference'.
2918 (\\) :: Ord k => Map k a -> Map k b -> Map k a
2919 m1 \\ m2 = difference m1 m2
2920-#if __GLASGOW_HASKELL__>= 700
2921+#if __GLASGOW_HASKELL__ >= 700
2922 {-# INLINABLE (\\) #-}
2923 #endif
2924 
2925hunk ./Data/Map.hs 285
2926 null :: Map k a -> Bool
2927 null Tip      = True
2928 null (Bin {}) = False
2929-#if __GLASGOW_HASKELL__>= 700
2930+#if __GLASGOW_HASKELL__ >= 700
2931 {-# INLINABLE null #-}
2932 #endif
2933 
2934hunk ./Data/Map.hs 298
2935 size :: Map k a -> Int
2936 size Tip              = 0
2937 size (Bin sz _ _ _ _) = sz
2938-#if __GLASGOW_HASKELL__>= 700
2939+#if __GLASGOW_HASKELL__ >= 700
2940 {-# INLINABLE size #-}
2941 #endif
2942 
2943hunk ./Data/Map.hs 383
2944 find k m = case lookup k m of
2945     Nothing -> error "Map.find: element not in the map"
2946     Just x  -> x
2947-#if __GLASGOW_HASKELL__>= 700
2948+#if __GLASGOW_HASKELL__ >= 700
2949 {-# INLINABLE find #-}
2950 #endif
2951 
2952hunk ./Data/Map.hs 398
2953 findWithDefault def k m = case lookup k m of
2954     Nothing -> def
2955     Just x  -> x
2956-#if __GLASGOW_HASKELL__>= 700
2957+#if __GLASGOW_HASKELL__ >= 700
2958 {-# INLINABLE findWithDefault #-}
2959 #endif
2960 
2961hunk ./Data/Map.hs 412
2962 
2963 empty :: Map k a
2964 empty = Tip
2965-#if __GLASGOW_HASKELL__>= 700
2966+#if __GLASGOW_HASKELL__ >= 700
2967 {-# INLINABLE empty #-}
2968 #endif
2969 
2970hunk ./Data/Map.hs 423
2971 
2972 singleton :: k -> a -> Map k a
2973 singleton k x = Bin 1 k x Tip Tip
2974-#if __GLASGOW_HASKELL__>= 700
2975+#if __GLASGOW_HASKELL__ >= 700
2976 {-# INLINABLE singleton #-}
2977 #endif
2978 
2979hunk ./Data/Map.hs 712
2980   = case lookupIndex k t of
2981       Nothing  -> error "Map.findIndex: element is not in the map"
2982       Just idx -> idx
2983-#if __GLASGOW_HASKELL__>= 700
2984+#if __GLASGOW_HASKELL__ >= 700
2985 {-# INLINABLE findIndex #-}
2986 #endif
2987 
2988hunk ./Data/Map.hs 735
2989           LT -> go k idx l
2990           GT -> go k (idx + size l + 1) r
2991           EQ -> Just (idx + size l)
2992-#if __GLASGOW_HASKELL__>= 700
2993+#if __GLASGOW_HASKELL__ >= 700
2994 {-# INLINABLE lookupIndex #-}
2995 #endif
2996 
2997hunk ./Data/Map.hs 756
2998       EQ -> (kx,x)
2999   where
3000     sizeL = size l
3001-#if __GLASGOW_HASKELL__>= 700
3002+#if __GLASGOW_HASKELL__ >= 700
3003 {-# INLINABLE elemAt #-}
3004 #endif
3005 
3006hunk ./Data/Map.hs 785
3007               Nothing -> glue l r
3008       where
3009         sizeL = size l
3010-#if __GLASGOW_HASKELL__>= 700
3011+#if __GLASGOW_HASKELL__ >= 700
3012 {-# INLINABLE updateAt #-}
3013 #endif
3014 
3015hunk ./Data/Map.hs 800
3016 deleteAt :: Int -> Map k a -> Map k a
3017 deleteAt i m
3018   = updateAt (\_ _ -> Nothing) i m
3019-#if __GLASGOW_HASKELL__>= 700
3020+#if __GLASGOW_HASKELL__ >= 700
3021 {-# INLINABLE deleteAt #-}
3022 #endif
3023 
3024hunk ./Data/Map.hs 817
3025 findMin (Bin _ kx x Tip _)  = (kx,x)
3026 findMin (Bin _ _  _ l _)    = findMin l
3027 findMin Tip                 = error "Map.findMin: empty map has no minimal element"
3028-#if __GLASGOW_HASKELL__>= 700
3029+#if __GLASGOW_HASKELL__ >= 700
3030 {-# INLINABLE findMin #-}
3031 #endif
3032 
3033hunk ./Data/Map.hs 830
3034 findMax (Bin _ kx x _ Tip)  = (kx,x)
3035 findMax (Bin _ _  _ _ r)    = findMax r
3036 findMax Tip                 = error "Map.findMax: empty map has no maximal element"
3037-#if __GLASGOW_HASKELL__>= 700
3038+#if __GLASGOW_HASKELL__ >= 700
3039 {-# INLINABLE findMax #-}
3040 #endif
3041 
3042hunk ./Data/Map.hs 843
3043 deleteMin (Bin _ _  _ Tip r)  = r
3044 deleteMin (Bin _ kx x l r)    = balanceR kx x (deleteMin l) r
3045 deleteMin Tip                 = Tip
3046-#if __GLASGOW_HASKELL__>= 700
3047+#if __GLASGOW_HASKELL__ >= 700
3048 {-# INLINABLE deleteMin #-}
3049 #endif
3050 
3051hunk ./Data/Map.hs 856
3052 deleteMax (Bin _ _  _ l Tip)  = l
3053 deleteMax (Bin _ kx x l r)    = balanceL kx x l (deleteMax r)
3054 deleteMax Tip                 = Tip
3055-#if __GLASGOW_HASKELL__>= 700
3056+#if __GLASGOW_HASKELL__ >= 700
3057 {-# INLINABLE deleteMax #-}
3058 #endif
3059 
3060hunk ./Data/Map.hs 868
3061 updateMin :: (a -> Maybe a) -> Map k a -> Map k a
3062 updateMin f m
3063   = updateMinWithKey (\_ x -> f x) m
3064-#if __GLASGOW_HASKELL__>= 700
3065+#if __GLASGOW_HASKELL__ >= 700
3066 {-# INLINABLE updateMin #-}
3067 #endif
3068 
3069hunk ./Data/Map.hs 880
3070 updateMax :: (a -> Maybe a) -> Map k a -> Map k a
3071 updateMax f m
3072   = updateMaxWithKey (\_ x -> f x) m
3073-#if __GLASGOW_HASKELL__>= 700
3074+#if __GLASGOW_HASKELL__ >= 700
3075 {-# INLINABLE updateMax #-}
3076 #endif
3077 
3078hunk ./Data/Map.hs 898
3079                                   Just x' -> Bin sx kx x' Tip r
3080     go f (Bin _ kx x l r)    = balanceR kx x (go f l) r
3081     go f Tip                 = Tip
3082-#if __GLASGOW_HASKELL__>= 700
3083+#if __GLASGOW_HASKELL__ >= 700
3084 {-# INLINABLE updateMinWithKey #-}
3085 #endif
3086 
3087hunk ./Data/Map.hs 915
3088                               Just x' -> Bin sx kx x' l Tip
3089     go f (Bin _ kx x l r)    = balanceL kx x l (go f r)
3090     go f Tip                 = Tip
3091-#if __GLASGOW_HASKELL__>= 700
3092+#if __GLASGOW_HASKELL__ >= 700
3093 {-# INLINABLE updateMaxWithKey #-}
3094 #endif
3095 
3096hunk ./Data/Map.hs 928
3097 minViewWithKey :: Map k a -> Maybe ((k,a), Map k a)
3098 minViewWithKey Tip = Nothing
3099 minViewWithKey x   = Just (deleteFindMin x)
3100-#if __GLASGOW_HASKELL__>= 700
3101+#if __GLASGOW_HASKELL__ >= 700
3102 {-# INLINABLE minViewWithKey #-}
3103 #endif
3104 
3105hunk ./Data/Map.hs 941
3106 maxViewWithKey :: Map k a -> Maybe ((k,a), Map k a)
3107 maxViewWithKey Tip = Nothing
3108 maxViewWithKey x   = Just (deleteFindMax x)
3109-#if __GLASGOW_HASKELL__>= 700
3110+#if __GLASGOW_HASKELL__ >= 700
3111 {-# INLINABLE maxViewWithKey #-}
3112 #endif
3113 
3114hunk ./Data/Map.hs 955
3115 minView :: Map k a -> Maybe (a, Map k a)
3116 minView Tip = Nothing
3117 minView x   = Just (first snd $ deleteFindMin x)
3118-#if __GLASGOW_HASKELL__>= 700
3119+#if __GLASGOW_HASKELL__ >= 700
3120 {-# INLINABLE minView #-}
3121 #endif
3122 
3123hunk ./Data/Map.hs 968
3124 maxView :: Map k a -> Maybe (a, Map k a)
3125 maxView Tip = Nothing
3126 maxView x   = Just (first snd $ deleteFindMax x)
3127-#if __GLASGOW_HASKELL__>= 700
3128+#if __GLASGOW_HASKELL__ >= 700
3129 {-# INLINABLE maxView #-}
3130 #endif
3131 
3132hunk ./Data/Map.hs 975
3133 -- Update the 1st component of a tuple (special case of Control.Arrow.first)
3134 first :: (a -> b) -> (a,c) -> (b,c)
3135 first f (x,y) = (f x, y)
3136-#if __GLASGOW_HASKELL__>= 700
3137+#if __GLASGOW_HASKELL__ >= 700
3138 {-# INLINABLE first #-}
3139 #endif
3140 
3141hunk ./Data/Map.hs 993
3142 unions :: Ord k => [Map k a] -> Map k a
3143 unions ts
3144   = foldlStrict union empty ts
3145-#if __GLASGOW_HASKELL__>= 700
3146+#if __GLASGOW_HASKELL__ >= 700
3147 {-# INLINABLE unions #-}
3148 #endif
3149 
3150hunk ./Data/Map.hs 1006
3151 unionsWith :: Ord k => (a->a->a) -> [Map k a] -> Map k a
3152 unionsWith f ts
3153   = foldlStrict (unionWith f) empty ts
3154-#if __GLASGOW_HASKELL__>= 700
3155+#if __GLASGOW_HASKELL__ >= 700
3156 {-# INLINABLE unionsWith #-}
3157 #endif
3158 
3159hunk ./Data/Map.hs 1025
3160 union (Bin _ k x Tip Tip) t = insert k x t
3161 union t (Bin _ k x Tip Tip) = insertWith (\_ y->y) k x t
3162 union t1 t2 = hedgeUnionL NothingS NothingS t1 t2
3163-#if __GLASGOW_HASKELL__>= 700
3164+#if __GLASGOW_HASKELL__ >= 700
3165 {-# INLINABLE union #-}
3166 #endif
3167 
3168hunk ./Data/Map.hs 1042
3169               (hedgeUnionL bmi bhi r (trim bmi bhi t2))
3170   where
3171     bmi = JustS kx
3172-#if __GLASGOW_HASKELL__>= 700
3173+#if __GLASGOW_HASKELL__ >= 700
3174 {-# INLINABLE hedgeUnionL #-}
3175 #endif
3176 
3177hunk ./Data/Map.hs 1056
3178 unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
3179 unionWith f m1 m2
3180   = unionWithKey (\_ x y -> f x y) m1 m2
3181-#if __GLASGOW_HASKELL__>= 700
3182+#if __GLASGOW_HASKELL__ >= 700
3183 {-# INLINABLE unionWith #-}
3184 #endif
3185 
3186hunk ./Data/Map.hs 1071
3187 unionWithKey _ Tip t2  = t2
3188 unionWithKey _ t1 Tip  = t1
3189 unionWithKey f t1 t2 = hedgeUnionWithKey f NothingS NothingS t1 t2
3190-#if __GLASGOW_HASKELL__>= 700
3191+#if __GLASGOW_HASKELL__ >= 700
3192 {-# INLINABLE unionWithKey #-}
3193 #endif
3194 
3195hunk ./Data/Map.hs 1094
3196     newx       = case found of
3197                    Nothing -> x
3198                    Just (_,y) -> f kx x y
3199-#if __GLASGOW_HASKELL__>= 700
3200+#if __GLASGOW_HASKELL__ >= 700
3201 {-# INLINABLE hedgeUnionWithKey #-}
3202 #endif
3203 
3204hunk ./Data/Map.hs 1111
3205 difference Tip _   = Tip
3206 difference t1 Tip  = t1
3207 difference t1 t2   = hedgeDiff NothingS NothingS t1 t2
3208-#if __GLASGOW_HASKELL__>= 700
3209+#if __GLASGOW_HASKELL__ >= 700
3210 {-# INLINABLE difference #-}
3211 #endif
3212 
3213hunk ./Data/Map.hs 1127
3214           (hedgeDiff bmi bhi (trim bmi bhi t) r)
3215   where
3216     bmi = JustS kx
3217-#if __GLASGOW_HASKELL__>= 700
3218+#if __GLASGOW_HASKELL__ >= 700
3219 {-# INLINABLE hedgeDiff #-}
3220 #endif
3221 
3222hunk ./Data/Map.hs 1145
3223 differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
3224 differenceWith f m1 m2
3225   = differenceWithKey (\_ x y -> f x y) m1 m2
3226-#if __GLASGOW_HASKELL__>= 700
3227+#if __GLASGOW_HASKELL__ >= 700
3228 {-# INLINABLE differenceWith #-}
3229 #endif
3230 
3231hunk ./Data/Map.hs 1163
3232 differenceWithKey _ Tip _   = Tip
3233 differenceWithKey _ t1 Tip  = t1
3234 differenceWithKey f t1 t2   = hedgeDiffWithKey f NothingS NothingS t1 t2
3235-#if __GLASGOW_HASKELL__>= 700
3236+#if __GLASGOW_HASKELL__ >= 700
3237 {-# INLINABLE differenceWithKey #-}
3238 #endif
3239 
3240hunk ./Data/Map.hs 1189
3241     (found,gt) = trimLookupLo kx bhi t
3242     tl         = hedgeDiffWithKey f blo bmi lt l
3243     tr         = hedgeDiffWithKey f bmi bhi gt r
3244-#if __GLASGOW_HASKELL__>= 700
3245+#if __GLASGOW_HASKELL__ >= 700
3246 {-# INLINABLE hedgeDiffWithKey #-}
3247 #endif
3248 
3249hunk ./Data/Map.hs 1207
3250 intersection :: Ord k => Map k a -> Map k b -> Map k a
3251 intersection m1 m2
3252   = intersectionWithKey (\_ x _ -> x) m1 m2
3253-#if __GLASGOW_HASKELL__>= 700
3254+#if __GLASGOW_HASKELL__ >= 700
3255 {-# INLINABLE intersection #-}
3256 #endif
3257 
3258hunk ./Data/Map.hs 1218
3259 intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
3260 intersectionWith f m1 m2
3261   = intersectionWithKey (\_ x y -> f x y) m1 m2
3262-#if __GLASGOW_HASKELL__>= 700
3263+#if __GLASGOW_HASKELL__ >= 700
3264 {-# INLINABLE intersectionWith #-}
3265 #endif
3266 
3267hunk ./Data/Map.hs 1246
3268       in case found of
3269       Just x -> join k1 (f k1 x1 x) tl tr
3270       Nothing -> merge tl tr
3271-#if __GLASGOW_HASKELL__>= 700
3272+#if __GLASGOW_HASKELL__ >= 700
3273 {-# INLINABLE intersectionWithKey #-}
3274 #endif
3275 
3276hunk ./Data/Map.hs 1260
3277 --
3278 isSubmapOf :: (Ord k,Eq a) => Map k a -> Map k a -> Bool
3279 isSubmapOf m1 m2 = isSubmapOfBy (==) m1 m2
3280-#if __GLASGOW_HASKELL__>= 700
3281+#if __GLASGOW_HASKELL__ >= 700
3282 {-# INLINABLE isSubmapOf #-}
3283 #endif
3284 
3285hunk ./Data/Map.hs 1285
3286 isSubmapOfBy :: Ord k => (a->b->Bool) -> Map k a -> Map k b -> Bool
3287 isSubmapOfBy f t1 t2
3288   = (size t1 <= size t2) && (submap' f t1 t2)
3289-#if __GLASGOW_HASKELL__>= 700
3290+#if __GLASGOW_HASKELL__ >= 700
3291 {-# INLINABLE isSubmapOfBy #-}
3292 #endif
3293 
3294hunk ./Data/Map.hs 1298
3295       Just y  -> f x y && submap' f l lt && submap' f r gt
3296   where
3297     (lt,found,gt) = splitLookup kx t
3298-#if __GLASGOW_HASKELL__>= 700
3299+#if __GLASGOW_HASKELL__ >= 700
3300 {-# INLINABLE submap' #-}
3301 #endif
3302 
3303hunk ./Data/Map.hs 1307
3304 isProperSubmapOf :: (Ord k,Eq a) => Map k a -> Map k a -> Bool
3305 isProperSubmapOf m1 m2
3306   = isProperSubmapOfBy (==) m1 m2
3307-#if __GLASGOW_HASKELL__>= 700
3308+#if __GLASGOW_HASKELL__ >= 700
3309 {-# INLINABLE isProperSubmapOf #-}
3310 #endif
3311 
3312hunk ./Data/Map.hs 1332
3313 isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool
3314 isProperSubmapOfBy f t1 t2
3315   = (size t1 < size t2) && (submap' f t1 t2)
3316-#if __GLASGOW_HASKELL__>= 700
3317+#if __GLASGOW_HASKELL__ >= 700
3318 {-# INLINABLE isProperSubmapOfBy #-}
3319 #endif
3320 
3321hunk ./Data/Map.hs 1348
3322 filter :: Ord k => (a -> Bool) -> Map k a -> Map k a
3323 filter p m
3324   = filterWithKey (\_ x -> p x) m
3325-#if __GLASGOW_HASKELL__>= 700
3326+#if __GLASGOW_HASKELL__ >= 700
3327 {-# INLINABLE filter #-}
3328 #endif
3329 
3330hunk ./Data/Map.hs 1363
3331     go p (Bin _ kx x l r)
3332           | p kx x    = join kx x (go p l) (go p r)
3333           | otherwise = merge (go p l) (go p r)
3334-#if __GLASGOW_HASKELL__>= 700
3335+#if __GLASGOW_HASKELL__ >= 700
3336 {-# INLINABLE filterWithKey #-}
3337 #endif
3338 
3339hunk ./Data/Map.hs 1378
3340 partition :: Ord k => (a -> Bool) -> Map k a -> (Map k a,Map k a)
3341 partition p m
3342   = partitionWithKey (\_ x -> p x) m
3343-#if __GLASGOW_HASKELL__>= 700
3344+#if __GLASGOW_HASKELL__ >= 700
3345 {-# INLINABLE partition #-}
3346 #endif
3347 
3348hunk ./Data/Map.hs 1398
3349   where
3350     (l1,l2) = partitionWithKey p l
3351     (r1,r2) = partitionWithKey p r
3352-#if __GLASGOW_HASKELL__>= 700
3353+#if __GLASGOW_HASKELL__ >= 700
3354 {-# INLINABLE partitionWithKey #-}
3355 #endif
3356 
3357hunk ./Data/Map.hs 1409
3358 
3359 mapMaybe :: Ord k => (a -> Maybe b) -> Map k a -> Map k b
3360 mapMaybe f = mapMaybeWithKey (\_ x -> f x)
3361-#if __GLASGOW_HASKELL__>= 700
3362+#if __GLASGOW_HASKELL__ >= 700
3363 {-# INLINABLE mapMaybe #-}
3364 #endif
3365 
3366hunk ./Data/Map.hs 1425
3367     go f (Bin _ kx x l r) = case f kx x of
3368         Just y  -> join kx y (go f l) (go f r)
3369         Nothing -> merge (go f l) (go f r)
3370-#if __GLASGOW_HASKELL__>= 700
3371+#if __GLASGOW_HASKELL__ >= 700
3372 {-# INLINABLE mapMaybeWithKey #-}
3373 #endif
3374 
3375hunk ./Data/Map.hs 1441
3376 mapEither :: Ord k => (a -> Either b c) -> Map k a -> (Map k b, Map k c)
3377 mapEither f m
3378   = mapEitherWithKey (\_ x -> f x) m
3379-#if __GLASGOW_HASKELL__>= 700
3380+#if __GLASGOW_HASKELL__ >= 700
3381 {-# INLINABLE mapEither #-}
3382 #endif
3383 
3384hunk ./Data/Map.hs 1463
3385  where
3386     (l1,l2) = mapEitherWithKey f l
3387     (r1,r2) = mapEitherWithKey f r
3388-#if __GLASGOW_HASKELL__>= 700
3389+#if __GLASGOW_HASKELL__ >= 700
3390 {-# INLINABLE mapEitherWithKey #-}
3391 #endif
3392 
3393hunk ./Data/Map.hs 1476
3394 
3395 map :: (a -> b) -> Map k a -> Map k b
3396 map f = mapWithKey (\_ x -> f x)
3397-#if __GLASGOW_HASKELL__>= 700
3398+#if __GLASGOW_HASKELL__ >= 700
3399 {-# INLINABLE map #-}
3400 #endif
3401 
3402hunk ./Data/Map.hs 1490
3403   where
3404     go f Tip = Tip
3405     go f (Bin sx kx x l r) = Bin sx kx (f kx x) (go f l) (go f r)
3406-#if __GLASGOW_HASKELL__>= 700
3407+#if __GLASGOW_HASKELL__ >= 700
3408 {-# INLINABLE mapWithKey #-}
3409 #endif
3410 
3411hunk ./Data/Map.hs 1503
3412 mapAccum :: (a -> b -> (a,c)) -> a -> Map k b -> (a,Map k c)
3413 mapAccum f a m
3414   = mapAccumWithKey (\a' _ x' -> f a' x') a m
3415-#if __GLASGOW_HASKELL__>= 700
3416+#if __GLASGOW_HASKELL__ >= 700
3417 {-# INLINABLE mapAccum #-}
3418 #endif
3419 
3420hunk ./Data/Map.hs 1516
3421 mapAccumWithKey :: (a -> k -> b -> (a,c)) -> a -> Map k b -> (a,Map k c)
3422 mapAccumWithKey f a t
3423   = mapAccumL f a t
3424-#if __GLASGOW_HASKELL__>= 700
3425+#if __GLASGOW_HASKELL__ >= 700
3426 {-# INLINABLE mapAccumWithKey #-}
3427 #endif
3428 
3429hunk ./Data/Map.hs 1531
3430                      (a2,x') = f a1 kx x
3431                      (a3,r') = go f a2 r
3432                  in (a3,Bin sx kx x' l' r')
3433-#if __GLASGOW_HASKELL__>= 700
3434+#if __GLASGOW_HASKELL__ >= 700
3435 {-# INLINABLE mapAccumL #-}
3436 #endif
3437 
3438hunk ./Data/Map.hs 1546
3439                      (a2,x') = f a1 kx x
3440                      (a3,l') = go f a2 l
3441                  in (a3,Bin sx kx x' l' r')
3442-#if __GLASGOW_HASKELL__>= 700
3443+#if __GLASGOW_HASKELL__ >= 700
3444 {-# INLINABLE mapAccumRWithKey #-}
3445 #endif
3446 
3447hunk ./Data/Map.hs 1563
3448 
3449 mapKeys :: Ord k2 => (k1->k2) -> Map k1 a -> Map k2 a
3450 mapKeys = mapKeysWith (\x _ -> x)
3451-#if __GLASGOW_HASKELL__>= 700
3452+#if __GLASGOW_HASKELL__ >= 700
3453 {-# INLINABLE mapKeys #-}
3454 #endif
3455 
3456hunk ./Data/Map.hs 1580
3457 mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1->k2) -> Map k1 a -> Map k2 a
3458 mapKeysWith c f = fromListWith c . List.map fFirst . toList
3459     where fFirst (x,y) = (f x, y)
3460-#if __GLASGOW_HASKELL__>= 700
3461+#if __GLASGOW_HASKELL__ >= 700
3462 {-# INLINABLE mapKeysWith #-}
3463 #endif
3464 
3465hunk ./Data/Map.hs 1607
3466 mapKeysMonotonic _ Tip = Tip
3467 mapKeysMonotonic f (Bin sz k x l r) =
3468     Bin sz (f k) x (mapKeysMonotonic f l) (mapKeysMonotonic f r)
3469-#if __GLASGOW_HASKELL__>= 700
3470+#if __GLASGOW_HASKELL__ >= 700
3471 {-# INLINABLE mapKeysMonotonic #-}
3472 #endif
3473 
3474hunk ./Data/Map.hs 1625
3475 -- > fold f 0 (fromList [(5,"a"), (3,"bbb")]) == 4
3476 fold :: (a -> b -> b) -> b -> Map k a -> b
3477 fold f = foldWithKey (\_ x' z' -> f x' z')
3478-#if __GLASGOW_HASKELL__>= 700
3479+#if __GLASGOW_HASKELL__ >= 700
3480 {-# INLINABLE fold #-}
3481 #endif
3482 
3483hunk ./Data/Map.hs 1643
3484 foldWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b
3485 foldWithKey = foldrWithKey
3486 {-# DEPRECATED foldWithKey "Use foldrWithKey instead" #-}
3487-#if __GLASGOW_HASKELL__>= 700
3488+#if __GLASGOW_HASKELL__ >= 700
3489 {-# INLINABLE foldWithKey #-}
3490 #endif
3491 
3492hunk ./Data/Map.hs 1654
3493   where
3494     go f z Tip              = z
3495     go f z (Bin _ kx x l r) = go f (f kx x (go f z r)) l
3496-#if __GLASGOW_HASKELL__>= 700
3497+#if __GLASGOW_HASKELL__ >= 700
3498 {-# INLINABLE foldrWithKey #-}
3499 #endif
3500 
3501hunk ./Data/Map.hs 1665
3502   where
3503     go f z Tip              = z
3504     go f z (Bin _ kx x l r) = go f (f (go f z l) kx x) r
3505-#if __GLASGOW_HASKELL__>= 700
3506+#if __GLASGOW_HASKELL__ >= 700
3507 {-# INLINABLE foldlWithKey #-}
3508 #endif
3509 
3510hunk ./Data/Map.hs 1676
3511   where
3512     go z Tip              = z
3513     go z (Bin _ kx x l r) = z `seq` go (f (go z l) kx x) r
3514-#if __GLASGOW_HASKELL__>= 700
3515+#if __GLASGOW_HASKELL__ >= 700
3516 {-# INLINABLE foldlWithKey' #-}
3517 #endif
3518 -}
3519hunk ./Data/Map.hs 1693
3520 elems :: Map k a -> [a]
3521 elems m
3522   = [x | (_,x) <- assocs m]
3523-#if __GLASGOW_HASKELL__>= 700
3524+#if __GLASGOW_HASKELL__ >= 700
3525 {-# INLINABLE elems #-}
3526 #endif
3527 
3528hunk ./Data/Map.hs 1705
3529 keys  :: Map k a -> [k]
3530 keys m
3531   = [k | (k,_) <- assocs m]
3532-#if __GLASGOW_HASKELL__>= 700
3533+#if __GLASGOW_HASKELL__ >= 700
3534 {-# INLINABLE keys  #-}
3535 #endif
3536 
3537hunk ./Data/Map.hs 1716
3538 
3539 keysSet :: Map k a -> Set.Set k
3540 keysSet m = Set.fromDistinctAscList (keys m)
3541-#if __GLASGOW_HASKELL__>= 700
3542+#if __GLASGOW_HASKELL__ >= 700
3543 {-# INLINABLE keysSet #-}
3544 #endif
3545 
3546hunk ./Data/Map.hs 1728
3547 assocs :: Map k a -> [(k,a)]
3548 assocs m
3549   = toList m
3550-#if __GLASGOW_HASKELL__>= 700
3551+#if __GLASGOW_HASKELL__ >= 700
3552 {-# INLINABLE assocs #-}
3553 #endif
3554 
3555hunk ./Data/Map.hs 1749
3556   = foldlStrict ins empty xs
3557   where
3558     ins t (k,x) = insert k x t
3559-#if __GLASGOW_HASKELL__>= 700
3560+#if __GLASGOW_HASKELL__ >= 700
3561 {-# INLINABLE fromList #-}
3562 #endif
3563 
3564hunk ./Data/Map.hs 1761
3565 fromListWith :: Ord k => (a -> a -> a) -> [(k,a)] -> Map k a
3566 fromListWith f xs
3567   = fromListWithKey (\_ x y -> f x y) xs
3568-#if __GLASGOW_HASKELL__>= 700
3569+#if __GLASGOW_HASKELL__ >= 700
3570 {-# INLINABLE fromListWith #-}
3571 #endif
3572 
3573hunk ./Data/Map.hs 1776
3574   = foldlStrict ins empty xs
3575   where
3576     ins t (k,x) = insertWithKey f k x t
3577-#if __GLASGOW_HASKELL__>= 700
3578+#if __GLASGOW_HASKELL__ >= 700
3579 {-# INLINABLE fromListWithKey #-}
3580 #endif
3581 
3582hunk ./Data/Map.hs 1787
3583 
3584 toList :: Map k a -> [(k,a)]
3585 toList t      = toAscList t
3586-#if __GLASGOW_HASKELL__>= 700
3587+#if __GLASGOW_HASKELL__ >= 700
3588 {-# INLINABLE toList #-}
3589 #endif
3590 
3591hunk ./Data/Map.hs 1797
3592 
3593 toAscList :: Map k a -> [(k,a)]
3594 toAscList t   = foldrWithKey (\k x xs -> (k,x):xs) [] t
3595-#if __GLASGOW_HASKELL__>= 700
3596+#if __GLASGOW_HASKELL__ >= 700
3597 {-# INLINABLE toAscList #-}
3598 #endif
3599 
3600hunk ./Data/Map.hs 1804
3601 -- | /O(n)/. Convert to a descending list.
3602 toDescList :: Map k a -> [(k,a)]
3603 toDescList t  = foldlWithKey (\xs k x -> (k,x):xs) [] t
3604-#if __GLASGOW_HASKELL__>= 700
3605+#if __GLASGOW_HASKELL__ >= 700
3606 {-# INLINABLE toDescList #-}
3607 #endif
3608 
3609hunk ./Data/Map.hs 1826
3610 fromAscList :: Eq k => [(k,a)] -> Map k a
3611 fromAscList xs
3612   = fromAscListWithKey (\_ x _ -> x) xs
3613-#if __GLASGOW_HASKELL__>= 700
3614+#if __GLASGOW_HASKELL__ >= 700
3615 {-# INLINABLE fromAscList #-}
3616 #endif
3617 
3618hunk ./Data/Map.hs 1840
3619 fromAscListWith :: Eq k => (a -> a -> a) -> [(k,a)] -> Map k a
3620 fromAscListWith f xs
3621   = fromAscListWithKey (\_ x y -> f x y) xs
3622-#if __GLASGOW_HASKELL__>= 700
3623+#if __GLASGOW_HASKELL__ >= 700
3624 {-# INLINABLE fromAscListWith #-}
3625 #endif
3626 
3627hunk ./Data/Map.hs 1868
3628   combineEq' z@(kz,zz) (x@(kx,xx):xs')
3629     | kx==kz    = let yy = f kx xx zz in combineEq' (kx,yy) xs'
3630     | otherwise = z:combineEq' x xs'
3631-#if __GLASGOW_HASKELL__>= 700
3632+#if __GLASGOW_HASKELL__ >= 700
3633 {-# INLINABLE fromAscListWithKey #-}
3634 #endif
3635 
3636hunk ./Data/Map.hs 1899
3637     buildR n c l ((k,x):ys) = build (buildB l k x c) n ys
3638     buildR _ _ _ []         = error "fromDistinctAscList buildR []"
3639     buildB l k x c r zs     = c (bin k x l r) zs
3640-#if __GLASGOW_HASKELL__>= 700
3641+#if __GLASGOW_HASKELL__ >= 700
3642 {-# INLINABLE fromDistinctAscList #-}
3643 #endif
3644 
3645hunk ./Data/Map.hs 1938
3646 trim (JustS lo) (JustS hi) t = middle lo hi t  where middle lo hi (Bin _ k _ _ r) | k <= lo = middle lo hi r
3647                                                      middle lo hi (Bin _ k _ l _) | k >= hi = middle lo hi l
3648                                                      middle lo hi t' = t'
3649-#if __GLASGOW_HASKELL__>= 700
3650+#if __GLASGOW_HASKELL__ >= 700
3651 {-# INLINABLE trim #-}
3652 #endif
3653 
3654hunk ./Data/Map.hs 1953
3655       EQ -> (Just (kx,x),trim (JustS lo) hi r)
3656   where compare' _    NothingS   = LT
3657         compare' kx' (JustS hi') = compare kx' hi'
3658-#if __GLASGOW_HASKELL__>= 700
3659+#if __GLASGOW_HASKELL__ >= 700
3660 {-# INLINABLE trimLookupLo #-}
3661 #endif
3662 
3663hunk ./Data/Map.hs 1969
3664         filter' b (Bin _ kx x l r) = case compare b kx of LT -> join kx x (filter' b l) r
3665                                                           EQ -> r
3666                                                           GT -> filter' b r
3667-#if __GLASGOW_HASKELL__>= 700
3668+#if __GLASGOW_HASKELL__ >= 700
3669 {-# INLINABLE filterGt #-}
3670 #endif
3671 
3672hunk ./Data/Map.hs 1980
3673         filter' b (Bin _ kx x l r) = case compare kx b of LT -> join kx x l (filter' b r)
3674                                                           EQ -> l
3675                                                           GT -> filter' b l
3676-#if __GLASGOW_HASKELL__>= 700
3677+#if __GLASGOW_HASKELL__ >= 700
3678 {-# INLINABLE filterLt #-}
3679 #endif
3680 
3681hunk ./Data/Map.hs 2006
3682           LT -> let (lt,gt) = go k l in (lt,join kx x gt r)
3683           GT -> let (lt,gt) = go k r in (join kx x l lt,gt)
3684           EQ -> (l,r)
3685-#if __GLASGOW_HASKELL__>= 700
3686+#if __GLASGOW_HASKELL__ >= 700
3687 {-# INLINABLE split #-}
3688 #endif
3689 
3690hunk ./Data/Map.hs 2028
3691       LT -> let (lt,z,gt) = go k l in (lt,z,join kx x gt r)
3692       GT -> let (lt,z,gt) = go k r in (join kx x l lt,z,gt)
3693       EQ -> (l,Just x,r)
3694-#if __GLASGOW_HASKELL__>= 700
3695+#if __GLASGOW_HASKELL__ >= 700
3696 {-# INLINABLE splitLookup #-}
3697 #endif
3698 
3699hunk ./Data/Map.hs 2042
3700       LT -> let (lt,z,gt) = go k l in (lt,z,join kx x gt r)
3701       GT -> let (lt,z,gt) = go k r in (join kx x l lt,z,gt)
3702       EQ -> (l,Just (kx, x),r)
3703-#if __GLASGOW_HASKELL__>= 700
3704+#if __GLASGOW_HASKELL__ >= 700
3705 {-# INLINABLE splitLookupWithKey #-}
3706 #endif
3707 
3708hunk ./Data/Map.hs 2085
3709   | delta*sizeL < sizeR  = balanceL kz z (join kx x l lz) rz
3710   | delta*sizeR < sizeL  = balanceR ky y ly (join kx x ry r)
3711   | otherwise            = bin kx x l r
3712-#if __GLASGOW_HASKELL__>= 700
3713+#if __GLASGOW_HASKELL__ >= 700
3714 {-# INLINABLE join #-}
3715 #endif
3716 
3717hunk ./Data/Map.hs 2097
3718       Tip -> singleton kx x
3719       Bin _ ky y l r
3720           -> balanceR ky y l (insertMax kx x r)
3721-#if __GLASGOW_HASKELL__>= 700
3722+#if __GLASGOW_HASKELL__ >= 700
3723 {-# INLINABLE insertMax #-}
3724 #endif
3725 
3726hunk ./Data/Map.hs 2106
3727       Tip -> singleton kx x
3728       Bin _ ky y l r
3729           -> balanceL ky y (insertMin kx x l) r
3730-#if __GLASGOW_HASKELL__>= 700
3731+#if __GLASGOW_HASKELL__ >= 700
3732 {-# INLINABLE insertMin #-}
3733 #endif
3734 
3735hunk ./Data/Map.hs 2120
3736   | delta*sizeL < sizeR = balanceL ky y (merge l ly) ry
3737   | delta*sizeR < sizeL = balanceR kx x lx (merge rx r)
3738   | otherwise           = glue l r
3739-#if __GLASGOW_HASKELL__>= 700
3740+#if __GLASGOW_HASKELL__ >= 700
3741 {-# INLINABLE merge #-}
3742 #endif
3743 
3744hunk ./Data/Map.hs 2134
3745 glue l r   
3746   | size l > size r = let ((km,m),l') = deleteFindMax l in balanceR km m l' r
3747   | otherwise       = let ((km,m),r') = deleteFindMin r in balanceL km m l r'
3748-#if __GLASGOW_HASKELL__>= 700
3749+#if __GLASGOW_HASKELL__ >= 700
3750 {-# INLINABLE glue #-}
3751 #endif
3752 
3753hunk ./Data/Map.hs 2150
3754       Bin _ k x Tip r -> ((k,x),r)
3755       Bin _ k x l r   -> let (km,l') = deleteFindMin l in (km,balanceR k x l' r)
3756       Tip             -> (error "Map.deleteFindMin: can not return the minimal element of an empty map", Tip)
3757-#if __GLASGOW_HASKELL__>= 700
3758+#if __GLASGOW_HASKELL__ >= 700
3759 {-# INLINABLE deleteFindMin #-}
3760 #endif
3761 
3762hunk ./Data/Map.hs 2165
3763       Bin _ k x l Tip -> ((k,x),l)
3764       Bin _ k x l r   -> let (km,r') = deleteFindMax r in (km,balanceL k x l r')
3765       Tip             -> (error "Map.deleteFindMax: can not return the maximal element of an empty map", Tip)
3766-#if __GLASGOW_HASKELL__>= 700
3767+#if __GLASGOW_HASKELL__ >= 700
3768 {-# INLINABLE deleteFindMax #-}
3769 #endif
3770 
3771hunk ./Data/Map.hs 2332
3772 bin :: k -> a -> Map k a -> Map k a -> Map k a
3773 bin k x l r
3774   = Bin (size l + size r + 1) k x l r
3775-#if __GLASGOW_HASKELL__>= 700
3776+#if __GLASGOW_HASKELL__ >= 700
3777 {-# INLINABLE bin #-}
3778 #endif
3779 
3780hunk ./Data/Map.hs 2543
3781     STRICT23(go)
3782     go f z []     = z
3783     go f z (x:xs) = go f (f z x) xs
3784-#if __GLASGOW_HASKELL__>= 700
3785+#if __GLASGOW_HASKELL__ >= 700
3786 {-# INLINABLE foldlStrict #-}
3787 #endif
3788hunk ./Data/Set.hs 151
3789 -- | /O(n+m)/. See 'difference'.
3790 (\\) :: Ord a => Set a -> Set a -> Set a
3791 m1 \\ m2 = difference m1 m2
3792-#if __GLASGOW_HASKELL__>= 700
3793+#if __GLASGOW_HASKELL__ >= 700
3794 {-# INLINABLE (\\) #-}
3795 #endif
3796 
3797hunk ./Data/Set.hs 198
3798 null :: Set a -> Bool
3799 null Tip      = True
3800 null (Bin {}) = False
3801-#if __GLASGOW_HASKELL__>= 700
3802+#if __GLASGOW_HASKELL__ >= 700
3803 {-# INLINABLE null #-}
3804 #endif
3805 
3806hunk ./Data/Set.hs 208
3807   where
3808     go Tip            = 0
3809     go (Bin sz _ _ _) = sz
3810-#if __GLASGOW_HASKELL__>= 700
3811+#if __GLASGOW_HASKELL__ >= 700
3812 {-# INLINABLE size #-}
3813 #endif
3814 
3815hunk ./Data/Set.hs 235
3816 -- | /O(1)/. The empty set.
3817 empty  :: Set a
3818 empty = Tip
3819-#if __GLASGOW_HASKELL__>= 700
3820+#if __GLASGOW_HASKELL__ >= 700
3821 {-# INLINABLE empty  #-}
3822 #endif
3823 
3824hunk ./Data/Set.hs 242
3825 -- | /O(1)/. Create a singleton set.
3826 singleton :: a -> Set a
3827 singleton x = Bin 1 x Tip Tip
3828-#if __GLASGOW_HASKELL__>= 700
3829+#if __GLASGOW_HASKELL__ >= 700
3830 {-# INLINABLE singleton #-}
3831 #endif
3832 
3833hunk ./Data/Set.hs 295
3834 isProperSubsetOf :: Ord a => Set a -> Set a -> Bool
3835 isProperSubsetOf s1 s2
3836     = (size s1 < size s2) && (isSubsetOf s1 s2)
3837-#if __GLASGOW_HASKELL__>= 700
3838+#if __GLASGOW_HASKELL__ >= 700
3839 {-# INLINABLE isProperSubsetOf #-}
3840 #endif
3841 
3842hunk ./Data/Set.hs 305
3843 isSubsetOf :: Ord a => Set a -> Set a -> Bool
3844 isSubsetOf t1 t2
3845   = (size t1 <= size t2) && (isSubsetOfX t1 t2)
3846-#if __GLASGOW_HASKELL__>= 700
3847+#if __GLASGOW_HASKELL__ >= 700
3848 {-# INLINABLE isSubsetOf #-}
3849 #endif
3850 
3851hunk ./Data/Set.hs 316
3852   = found && isSubsetOfX l lt && isSubsetOfX r gt
3853   where
3854     (lt,found,gt) = splitMember x t
3855-#if __GLASGOW_HASKELL__>= 700
3856+#if __GLASGOW_HASKELL__ >= 700
3857 {-# INLINABLE isSubsetOfX #-}
3858 #endif
3859 
3860hunk ./Data/Set.hs 329
3861 findMin (Bin _ x Tip _) = x
3862 findMin (Bin _ _ l _)   = findMin l
3863 findMin Tip             = error "Set.findMin: empty set has no minimal element"
3864-#if __GLASGOW_HASKELL__>= 700
3865+#if __GLASGOW_HASKELL__ >= 700
3866 {-# INLINABLE findMin #-}
3867 #endif
3868 
3869hunk ./Data/Set.hs 338
3870 findMax (Bin _ x _ Tip)  = x
3871 findMax (Bin _ _ _ r)    = findMax r
3872 findMax Tip              = error "Set.findMax: empty set has no maximal element"
3873-#if __GLASGOW_HASKELL__>= 700
3874+#if __GLASGOW_HASKELL__ >= 700
3875 {-# INLINABLE findMax #-}
3876 #endif
3877 
3878hunk ./Data/Set.hs 347
3879 deleteMin (Bin _ _ Tip r) = r
3880 deleteMin (Bin _ x l r)   = balanceR x (deleteMin l) r
3881 deleteMin Tip             = Tip
3882-#if __GLASGOW_HASKELL__>= 700
3883+#if __GLASGOW_HASKELL__ >= 700
3884 {-# INLINABLE deleteMin #-}
3885 #endif
3886 
3887hunk ./Data/Set.hs 356
3888 deleteMax (Bin _ _ l Tip) = l
3889 deleteMax (Bin _ x l r)   = balanceL x l (deleteMax r)
3890 deleteMax Tip             = Tip
3891-#if __GLASGOW_HASKELL__>= 700
3892+#if __GLASGOW_HASKELL__ >= 700
3893 {-# INLINABLE deleteMax #-}
3894 #endif
3895 
3896hunk ./Data/Set.hs 366
3897 -- | The union of a list of sets: (@'unions' == 'foldl' 'union' 'empty'@).
3898 unions :: Ord a => [Set a] -> Set a
3899 unions = foldlStrict union empty
3900-#if __GLASGOW_HASKELL__>= 700
3901+#if __GLASGOW_HASKELL__ >= 700
3902 {-# INLINABLE unions #-}
3903 #endif
3904 
3905hunk ./Data/Set.hs 380
3906 union (Bin _ x Tip Tip) t = insert x t
3907 union t (Bin _ x Tip Tip) = insertR x t
3908 union t1 t2 = hedgeUnion NothingS NothingS t1 t2
3909-#if __GLASGOW_HASKELL__>= 700
3910+#if __GLASGOW_HASKELL__ >= 700
3911 {-# INLINABLE union #-}
3912 #endif
3913 
3914hunk ./Data/Set.hs 395
3915            (hedgeUnion bmi bhi r (trim bmi bhi t2))
3916   where
3917     bmi = JustS x
3918-#if __GLASGOW_HASKELL__>= 700
3919+#if __GLASGOW_HASKELL__ >= 700
3920 {-# INLINABLE hedgeUnion #-}
3921 #endif
3922 
3923hunk ./Data/Set.hs 408
3924 difference Tip _   = Tip
3925 difference t1 Tip  = t1
3926 difference t1 t2   = hedgeDiff NothingS NothingS t1 t2
3927-#if __GLASGOW_HASKELL__>= 700
3928+#if __GLASGOW_HASKELL__ >= 700
3929 {-# INLINABLE difference #-}
3930 #endif
3931 
3932hunk ./Data/Set.hs 423
3933           (hedgeDiff bmi bhi (trim bmi bhi t) r)
3934   where
3935     bmi = JustS x
3936-#if __GLASGOW_HASKELL__>= 700
3937+#if __GLASGOW_HASKELL__ >= 700
3938 {-# INLINABLE hedgeDiff #-}
3939 #endif
3940 
3941hunk ./Data/Set.hs 457
3942             tr            = intersection r1 gt
3943         in if found then join x1 tl tr
3944            else merge tl tr
3945-#if __GLASGOW_HASKELL__>= 700
3946+#if __GLASGOW_HASKELL__ >= 700
3947 {-# INLINABLE intersection #-}
3948 #endif
3949 
3950hunk ./Data/Set.hs 472
3951     go (Bin _ x l r)
3952         | p x       = join x (go l) (go r)
3953         | otherwise = merge (go l) (go r)
3954-#if __GLASGOW_HASKELL__>= 700
3955+#if __GLASGOW_HASKELL__ >= 700
3956 {-# INLINABLE filter #-}
3957 #endif
3958 
3959hunk ./Data/Set.hs 487
3960         ((l1, l2), (r1, r2))
3961             | p x       -> (join x l1 r1, merge l2 r2)
3962             | otherwise -> (merge l1 r1, join x l2 r2)
3963-#if __GLASGOW_HASKELL__>= 700
3964+#if __GLASGOW_HASKELL__ >= 700
3965 {-# INLINABLE partition #-}
3966 #endif
3967 
3968hunk ./Data/Set.hs 503
3969 
3970 map :: (Ord a, Ord b) => (a->b) -> Set a -> Set b
3971 map f = fromList . List.map f . toList
3972-#if __GLASGOW_HASKELL__>= 700
3973+#if __GLASGOW_HASKELL__ >= 700
3974 {-# INLINABLE map #-}
3975 #endif
3976 
3977hunk ./Data/Set.hs 522
3978   where
3979     go Tip = Tip
3980     go (Bin sz x l r) = Bin sz (f x) (go l) (go r)
3981-#if __GLASGOW_HASKELL__>= 700
3982+#if __GLASGOW_HASKELL__ >= 700
3983 {-# INLINABLE mapMonotonic #-}
3984 #endif
3985 
3986hunk ./Data/Set.hs 532
3987 -- | /O(n)/. Fold over the elements of a set in an unspecified order.
3988 fold :: (a -> b -> b) -> b -> Set a -> b
3989 fold = foldr
3990-#if __GLASGOW_HASKELL__>= 700
3991+#if __GLASGOW_HASKELL__ >= 700
3992 {-# INLINABLE fold #-}
3993 #endif
3994 
3995hunk ./Data/Set.hs 542
3996   where
3997     go f z Tip           = z
3998     go f z (Bin _ x l r) = go f (f x (go f z r)) l
3999-#if __GLASGOW_HASKELL__>= 700
4000+#if __GLASGOW_HASKELL__ >= 700
4001 {-# INLINABLE foldr #-}
4002 #endif
4003 
4004hunk ./Data/Set.hs 552
4005 -- | /O(n)/. The elements of a set.
4006 elems :: Set a -> [a]
4007 elems = toList
4008-#if __GLASGOW_HASKELL__>= 700
4009+#if __GLASGOW_HASKELL__ >= 700
4010 {-# INLINABLE elems #-}
4011 #endif
4012 
4013hunk ./Data/Set.hs 562
4014 -- | /O(n)/. Convert the set to a list of elements.
4015 toList :: Set a -> [a]
4016 toList = toAscList
4017-#if __GLASGOW_HASKELL__>= 700
4018+#if __GLASGOW_HASKELL__ >= 700
4019 {-# INLINABLE toList #-}
4020 #endif
4021 
4022hunk ./Data/Set.hs 569
4023 -- | /O(n)/. Convert the set to an ascending list of elements.
4024 toAscList :: Set a -> [a]
4025 toAscList = foldr (:) []
4026-#if __GLASGOW_HASKELL__>= 700
4027+#if __GLASGOW_HASKELL__ >= 700
4028 {-# INLINABLE toAscList #-}
4029 #endif
4030 
4031hunk ./Data/Set.hs 578
4032 fromList = foldlStrict ins empty
4033   where
4034     ins t x = insert x t
4035-#if __GLASGOW_HASKELL__>= 700
4036+#if __GLASGOW_HASKELL__ >= 700
4037 {-# INLINABLE fromList #-}
4038 #endif
4039 
4040hunk ./Data/Set.hs 605
4041   combineEq' z (x:xs')
4042     | z==x      =   combineEq' z xs'
4043     | otherwise = z:combineEq' x xs'
4044-#if __GLASGOW_HASKELL__>= 700
4045+#if __GLASGOW_HASKELL__ >= 700
4046 {-# INLINABLE fromAscList #-}
4047 #endif
4048 
4049hunk ./Data/Set.hs 631
4050     buildR n c l (x:ys) = build (buildB l x c) n ys
4051     buildR _ _ _ []     = error "fromDistinctAscList buildR []"
4052     buildB l x c r zs   = c (bin x l r) zs
4053-#if __GLASGOW_HASKELL__>= 700
4054+#if __GLASGOW_HASKELL__ >= 700
4055 {-# INLINABLE fromDistinctAscList #-}
4056 #endif
4057 
4058hunk ./Data/Set.hs 716
4059 trim (JustS lx) (JustS hx) t = middle lx hx t  where middle lx hx (Bin _ x _ r) | x <= lx = middle lx hx r
4060                                                      middle lx hx (Bin _ x l _) | x >= hx = middle lx hx l
4061                                                      middle _  _  t' = t'
4062-#if __GLASGOW_HASKELL__>= 700
4063+#if __GLASGOW_HASKELL__ >= 700
4064 {-# INLINABLE trim #-}
4065 #endif
4066 
4067hunk ./Data/Set.hs 731
4068         filter' b (Bin _ x l r) = case compare b x of LT -> join x (filter' b l) r
4069                                                       EQ -> r
4070                                                       GT -> filter' b r
4071-#if __GLASGOW_HASKELL__>= 700
4072+#if __GLASGOW_HASKELL__ >= 700
4073 {-# INLINABLE filterGt #-}
4074 #endif
4075 
4076hunk ./Data/Set.hs 742
4077         filter' b (Bin _ x l r) = case compare x b of LT -> join x l (filter' b r)
4078                                                       EQ -> l
4079                                                       GT -> filter' b l
4080-#if __GLASGOW_HASKELL__>= 700
4081+#if __GLASGOW_HASKELL__ >= 700
4082 {-# INLINABLE filterLt #-}
4083 #endif
4084 
4085hunk ./Data/Set.hs 759
4086       LT -> let (lt,gt) = split x l in (lt,join y gt r)
4087       GT -> let (lt,gt) = split x r in (join y l lt,gt)
4088       EQ -> (l,r)
4089-#if __GLASGOW_HASKELL__>= 700
4090+#if __GLASGOW_HASKELL__ >= 700
4091 {-# INLINABLE split #-}
4092 #endif
4093 
4094hunk ./Data/Set.hs 768
4095 splitMember :: Ord a => a -> Set a -> (Set a,Bool,Set a)
4096 splitMember x t = let (l,m,r) = splitLookup x t in
4097      (l,maybe False (const True) m,r)
4098-#if __GLASGOW_HASKELL__>= 700
4099+#if __GLASGOW_HASKELL__ >= 700
4100 {-# INLINABLE splitMember #-}
4101 #endif
4102 
4103hunk ./Data/Set.hs 781
4104        LT -> let (lt,found,gt) = splitLookup x l in (lt,found,join y gt r)
4105        GT -> let (lt,found,gt) = splitLookup x r in (join y l lt,found,gt)
4106        EQ -> (l,Just y,r)
4107-#if __GLASGOW_HASKELL__>= 700
4108+#if __GLASGOW_HASKELL__ >= 700
4109 {-# INLINABLE splitLookup #-}
4110 #endif
4111 
4112hunk ./Data/Set.hs 824
4113   | delta*sizeL < sizeR  = balanceL z (join x l lz) rz
4114   | delta*sizeR < sizeL  = balanceR y ly (join x ry r)
4115   | otherwise            = bin x l r
4116-#if __GLASGOW_HASKELL__>= 700
4117+#if __GLASGOW_HASKELL__ >= 700
4118 {-# INLINABLE join #-}
4119 #endif
4120 
4121hunk ./Data/Set.hs 836
4122       Tip -> singleton x
4123       Bin _ y l r
4124           -> balanceR y l (insertMax x r)
4125-#if __GLASGOW_HASKELL__>= 700
4126+#if __GLASGOW_HASKELL__ >= 700
4127 {-# INLINABLE insertMax #-}
4128 #endif
4129 
4130hunk ./Data/Set.hs 845
4131       Tip -> singleton x
4132       Bin _ y l r
4133           -> balanceL y (insertMin x l) r
4134-#if __GLASGOW_HASKELL__>= 700
4135+#if __GLASGOW_HASKELL__ >= 700
4136 {-# INLINABLE insertMin #-}
4137 #endif
4138 
4139hunk ./Data/Set.hs 859
4140   | delta*sizeL < sizeR = balanceL y (merge l ly) ry
4141   | delta*sizeR < sizeL = balanceR x lx (merge rx r)
4142   | otherwise           = glue l r
4143-#if __GLASGOW_HASKELL__>= 700
4144+#if __GLASGOW_HASKELL__ >= 700
4145 {-# INLINABLE merge #-}
4146 #endif
4147 
4148hunk ./Data/Set.hs 873
4149 glue l r   
4150   | size l > size r = let (m,l') = deleteFindMax l in balanceR m l' r
4151   | otherwise       = let (m,r') = deleteFindMin r in balanceL m l r'
4152-#if __GLASGOW_HASKELL__>= 700
4153+#if __GLASGOW_HASKELL__ >= 700
4154 {-# INLINABLE glue #-}
4155 #endif
4156 
4157hunk ./Data/Set.hs 888
4158       Bin _ x Tip r -> (x,r)
4159       Bin _ x l r   -> let (xm,l') = deleteFindMin l in (xm,balanceR x l' r)
4160       Tip           -> (error "Set.deleteFindMin: can not return the minimal element of an empty set", Tip)
4161-#if __GLASGOW_HASKELL__>= 700
4162+#if __GLASGOW_HASKELL__ >= 700
4163 {-# INLINABLE deleteFindMin #-}
4164 #endif
4165 
4166hunk ./Data/Set.hs 901
4167       Bin _ x l Tip -> (x,l)
4168       Bin _ x l r   -> let (xm,r') = deleteFindMax r in (xm,balanceL x l r')
4169       Tip           -> (error "Set.deleteFindMax: can not return the maximal element of an empty set", Tip)
4170-#if __GLASGOW_HASKELL__>= 700
4171+#if __GLASGOW_HASKELL__ >= 700
4172 {-# INLINABLE deleteFindMax #-}
4173 #endif
4174 
4175hunk ./Data/Set.hs 910
4176 minView :: Set a -> Maybe (a, Set a)
4177 minView Tip = Nothing
4178 minView x = Just (deleteFindMin x)
4179-#if __GLASGOW_HASKELL__>= 700
4180+#if __GLASGOW_HASKELL__ >= 700
4181 {-# INLINABLE minView #-}
4182 #endif
4183 
4184hunk ./Data/Set.hs 919
4185 maxView :: Set a -> Maybe (a, Set a)
4186 maxView Tip = Nothing
4187 maxView x = Just (deleteFindMax x)
4188-#if __GLASGOW_HASKELL__>= 700
4189+#if __GLASGOW_HASKELL__ >= 700
4190 {-# INLINABLE maxView #-}
4191 #endif
4192 
4193hunk ./Data/Set.hs 1053
4194 bin :: a -> Set a -> Set a -> Set a
4195 bin x l r
4196   = Bin (size l + size r + 1) x l r
4197-#if __GLASGOW_HASKELL__>= 700
4198+#if __GLASGOW_HASKELL__ >= 700
4199 {-# INLINABLE bin #-}
4200 #endif
4201 
4202hunk ./Data/Set.hs 1067
4203     STRICT23(go)
4204     go f z []     = z
4205     go f z (x:xs) = go f (f z x) xs
4206-#if __GLASGOW_HASKELL__>= 700
4207+#if __GLASGOW_HASKELL__ >= 700
4208 {-# INLINABLE foldlStrict #-}
4209 #endif
4210 
4211}
4212[Changing INLINE pragmas.
4213Milan Straka <fox@ucw.cz>**20101016215959
4214 Ignore-this: 933327354749d18e4617280fde55cce0
4215 
4216 The internal functions that need to be inlined are marked INLINE
4217 (bit fiddling in IntMap/IntSet, empty, singleton, bin).
4218 
4219 Aslo if INLINABLE is available, use it for all exported functions.
4220 The functions like insert that were INLINE because of specialization
4221 issues are now INLINE only in the case of INLINABLE absence.
4222] {
4223hunk ./Data/IntMap.hs 215
4224 
4225 natFromInt :: Key -> Nat
4226 natFromInt = fromIntegral
4227-#if __GLASGOW_HASKELL__ >= 700
4228-{-# INLINABLE natFromInt #-}
4229-#endif
4230+{-# INLINE natFromInt #-}
4231 
4232 intFromNat :: Nat -> Key
4233 intFromNat = fromIntegral
4234hunk ./Data/IntMap.hs 219
4235-#if __GLASGOW_HASKELL__ >= 700
4236-{-# INLINABLE intFromNat #-}
4237-#endif
4238+{-# INLINE intFromNat #-}
4239 
4240 shiftRL :: Nat -> Key -> Nat
4241 #if __GLASGOW_HASKELL__
4242hunk ./Data/IntMap.hs 230
4243   = W# (shiftRL# x i)
4244 #else
4245 shiftRL x i   = shiftR x i
4246-#endif
4247-#if __GLASGOW_HASKELL__ >= 700
4248-{-# INLINABLE shiftRL #-}
4249+{-# INLINE shiftRL #-}
4250 #endif
4251 
4252 {--------------------------------------------------------------------
4253hunk ./Data/IntMap.hs 407
4254 empty :: IntMap a
4255 empty
4256   = Nil
4257-#if __GLASGOW_HASKELL__ >= 700
4258-{-# INLINABLE empty #-}
4259-#endif
4260+{-# INLINE empty #-}
4261 
4262 -- | /O(1)/. A map of one element.
4263 --
4264hunk ./Data/IntMap.hs 417
4265 singleton :: Key -> a -> IntMap a
4266 singleton k x
4267   = Tip k x
4268-#if __GLASGOW_HASKELL__ >= 700
4269-{-# INLINABLE singleton #-}
4270-#endif
4271+{-# INLINE singleton #-}
4272 
4273 {--------------------------------------------------------------------
4274   Insert
4275hunk ./Data/IntMap.hs 2015
4276   where
4277     m = branchMask p1 p2
4278     p = mask p1 m
4279-#if __GLASGOW_HASKELL__ >= 700
4280-{-# INLINABLE join #-}
4281-#endif
4282+{-# INLINE join #-}
4283 
4284 {--------------------------------------------------------------------
4285   @bin@ assures that we never have empty trees within a tree.
4286hunk ./Data/IntMap.hs 2024
4287 bin _ _ l Nil = l
4288 bin _ _ Nil r = r
4289 bin p m l r   = Bin p m l r
4290-#if __GLASGOW_HASKELL__ >= 700
4291-{-# INLINABLE bin #-}
4292-#endif
4293+{-# INLINE bin #-}
4294 
4295   
4296 {--------------------------------------------------------------------
4297hunk ./Data/IntMap.hs 2033
4298 zero :: Key -> Mask -> Bool
4299 zero i m
4300   = (natFromInt i) .&. (natFromInt m) == 0
4301-#if __GLASGOW_HASKELL__ >= 700
4302-{-# INLINABLE zero #-}
4303-#endif
4304+{-# INLINE zero #-}
4305 
4306 nomatch,match :: Key -> Prefix -> Mask -> Bool
4307 nomatch i p m
4308hunk ./Data/IntMap.hs 2038
4309   = (mask i m) /= p
4310-#if __GLASGOW_HASKELL__ >= 700
4311-{-# INLINABLE nomatch #-}
4312-#endif
4313+{-# INLINE nomatch #-}
4314 
4315 match i p m
4316   = (mask i m) == p
4317hunk ./Data/IntMap.hs 2042
4318-#if __GLASGOW_HASKELL__ >= 700
4319-{-# INLINABLE match #-}
4320-#endif
4321+{-# INLINE match #-}
4322 
4323 mask :: Key -> Mask -> Prefix
4324 mask i m
4325hunk ./Data/IntMap.hs 2047
4326   = maskW (natFromInt i) (natFromInt m)
4327-#if __GLASGOW_HASKELL__ >= 700
4328-{-# INLINABLE mask #-}
4329-#endif
4330+{-# INLINE mask #-}
4331 
4332 
4333 {--------------------------------------------------------------------
4334hunk ./Data/IntMap.hs 2056
4335 maskW :: Nat -> Nat -> Prefix
4336 maskW i m
4337   = intFromNat (i .&. (complement (m-1) `xor` m))
4338-#if __GLASGOW_HASKELL__ >= 700
4339-{-# INLINABLE maskW #-}
4340-#endif
4341+{-# INLINE maskW #-}
4342 
4343 shorter :: Mask -> Mask -> Bool
4344 shorter m1 m2
4345hunk ./Data/IntMap.hs 2061
4346   = (natFromInt m1) > (natFromInt m2)
4347-#if __GLASGOW_HASKELL__ >= 700
4348-{-# INLINABLE shorter #-}
4349-#endif
4350+{-# INLINE shorter #-}
4351 
4352 branchMask :: Prefix -> Prefix -> Mask
4353 branchMask p1 p2
4354hunk ./Data/IntMap.hs 2066
4355   = intFromNat (highestBitMask (natFromInt p1 `xor` natFromInt p2))
4356-#if __GLASGOW_HASKELL__ >= 700
4357-{-# INLINABLE branchMask #-}
4358-#endif
4359+{-# INLINE branchMask #-}
4360 
4361 {----------------------------------------------------------------------
4362   Finding the highest bit (mask) in a word [x] can be done efficiently in
4363hunk ./Data/IntMap.hs 2119
4364         x4 -> case (x4 .|. shiftRL x4 16) of
4365          x5 -> case (x5 .|. shiftRL x5 32) of   -- for 64 bit platforms
4366           x6 -> (x6 `xor` (shiftRL x6 1))
4367-#if __GLASGOW_HASKELL__ >= 700
4368-{-# INLINABLE highestBitMask #-}
4369-#endif
4370+{-# INLINE highestBitMask #-}
4371 
4372 
4373 {--------------------------------------------------------------------
4374hunk ./Data/IntMap.hs 2132
4375     STRICT23(go)
4376     go f z []     = z
4377     go f z (x:xs) = go f (f z x) xs
4378-#if __GLASGOW_HASKELL__ >= 700
4379-{-# INLINABLE foldlStrict #-}
4380-#endif
4381+{-# INLINE foldlStrict #-}
4382hunk ./Data/IntSet.hs 147
4383 
4384 natFromInt :: Int -> Nat
4385 natFromInt i = fromIntegral i
4386-#if __GLASGOW_HASKELL__ >= 700
4387-{-# INLINABLE natFromInt #-}
4388-#endif
4389+{-# INLINE natFromInt #-}
4390 
4391 intFromNat :: Nat -> Int
4392 intFromNat w = fromIntegral w
4393hunk ./Data/IntSet.hs 151
4394-#if __GLASGOW_HASKELL__ >= 700
4395-{-# INLINABLE intFromNat #-}
4396-#endif
4397+{-# INLINE intFromNat #-}
4398 
4399 shiftRL :: Nat -> Int -> Nat
4400 #if __GLASGOW_HASKELL__
4401hunk ./Data/IntSet.hs 162
4402   = W# (shiftRL# x i)
4403 #else
4404 shiftRL x i   = shiftR x i
4405-#endif
4406-#if __GLASGOW_HASKELL__ >= 700
4407-{-# INLINABLE shiftRL #-}
4408+{-# INLINE shiftRL #-}
4409 #endif
4410 
4411 {--------------------------------------------------------------------
4412hunk ./Data/IntSet.hs 281
4413 empty :: IntSet
4414 empty
4415   = Nil
4416-#if __GLASGOW_HASKELL__ >= 700
4417-{-# INLINABLE empty #-}
4418-#endif
4419+{-# INLINE empty #-}
4420 
4421 -- | /O(1)/. A set of one element.
4422 singleton :: Int -> IntSet
4423hunk ./Data/IntSet.hs 287
4424 singleton x
4425   = Tip x
4426-#if __GLASGOW_HASKELL__ >= 700
4427-{-# INLINABLE singleton #-}
4428-#endif
4429+{-# INLINE singleton #-}
4430 
4431 {--------------------------------------------------------------------
4432   Insert
4433hunk ./Data/IntSet.hs 1017
4434   where
4435     m = branchMask p1 p2
4436     p = mask p1 m
4437-#if __GLASGOW_HASKELL__ >= 700
4438-{-# INLINABLE join #-}
4439-#endif
4440+{-# INLINE join #-}
4441 
4442 {--------------------------------------------------------------------
4443   @bin@ assures that we never have empty trees within a tree.
4444hunk ./Data/IntSet.hs 1026
4445 bin _ _ l Nil = l
4446 bin _ _ Nil r = r
4447 bin p m l r   = Bin p m l r
4448-#if __GLASGOW_HASKELL__ >= 700
4449-{-# INLINABLE bin #-}
4450-#endif
4451+{-# INLINE bin #-}
4452 
4453   
4454 {--------------------------------------------------------------------
4455hunk ./Data/IntSet.hs 1035
4456 zero :: Int -> Mask -> Bool
4457 zero i m
4458   = (natFromInt i) .&. (natFromInt m) == 0
4459-#if __GLASGOW_HASKELL__ >= 700
4460-{-# INLINABLE zero #-}
4461-#endif
4462+{-# INLINE zero #-}
4463 
4464 nomatch,match :: Int -> Prefix -> Mask -> Bool
4465 nomatch i p m
4466hunk ./Data/IntSet.hs 1040
4467   = (mask i m) /= p
4468-#if __GLASGOW_HASKELL__ >= 700
4469-{-# INLINABLE nomatch #-}
4470-#endif
4471+{-# INLINE nomatch #-}
4472 
4473 match i p m
4474   = (mask i m) == p
4475hunk ./Data/IntSet.hs 1044
4476-#if __GLASGOW_HASKELL__ >= 700
4477-{-# INLINABLE match #-}
4478-#endif
4479+{-# INLINE match #-}
4480 
4481 -- Suppose a is largest such that 2^a divides 2*m.
4482 -- Then mask i m is i with the low a bits zeroed out.
4483hunk ./Data/IntSet.hs 1051
4484 mask :: Int -> Mask -> Prefix
4485 mask i m
4486   = maskW (natFromInt i) (natFromInt m)
4487-#if __GLASGOW_HASKELL__ >= 700
4488-{-# INLINABLE mask #-}
4489-#endif
4490+{-# INLINE mask #-}
4491 
4492 {--------------------------------------------------------------------
4493   Big endian operations 
4494hunk ./Data/IntSet.hs 1059
4495 maskW :: Nat -> Nat -> Prefix
4496 maskW i m
4497   = intFromNat (i .&. (complement (m-1) `xor` m))
4498-#if __GLASGOW_HASKELL__ >= 700
4499-{-# INLINABLE maskW #-}
4500-#endif
4501+{-# INLINE maskW #-}
4502 
4503 shorter :: Mask -> Mask -> Bool
4504 shorter m1 m2
4505hunk ./Data/IntSet.hs 1064
4506   = (natFromInt m1) > (natFromInt m2)
4507-#if __GLASGOW_HASKELL__ >= 700
4508-{-# INLINABLE shorter #-}
4509-#endif
4510+{-# INLINE shorter #-}
4511 
4512 branchMask :: Prefix -> Prefix -> Mask
4513 branchMask p1 p2
4514hunk ./Data/IntSet.hs 1069
4515   = intFromNat (highestBitMask (natFromInt p1 `xor` natFromInt p2))
4516-#if __GLASGOW_HASKELL__ >= 700
4517-{-# INLINABLE branchMask #-}
4518-#endif
4519+{-# INLINE branchMask #-}
4520 
4521 {----------------------------------------------------------------------
4522   Finding the highest bit (mask) in a word [x] can be done efficiently in
4523hunk ./Data/IntSet.hs 1122
4524         x4 -> case (x4 .|. shiftRL x4 16) of
4525          x5 -> case (x5 .|. shiftRL x5 32) of   -- for 64 bit platforms
4526           x6 -> (x6 `xor` (shiftRL x6 1))
4527-#if __GLASGOW_HASKELL__ >= 700
4528-{-# INLINABLE highestBitMask #-}
4529-#endif
4530+{-# INLINE highestBitMask #-}
4531 
4532 
4533 {--------------------------------------------------------------------
4534hunk ./Data/IntSet.hs 1134
4535     STRICT23(go)
4536     go f z []     = z
4537     go f z (x:xs) = go f (f z x) xs
4538-#if __GLASGOW_HASKELL__ >= 700
4539-{-# INLINABLE foldlStrict #-}
4540-#endif
4541+{-# INLINE foldlStrict #-}
4542hunk ./Data/Map.hs 231
4543 
4544 (!) :: Ord k => Map k a -> k -> a
4545 m ! k    = find k m
4546-#if __GLASGOW_HASKELL__ >= 700
4547-{-# INLINABLE (!) #-}
4548-#endif
4549+{-# INLINE (!) #-}
4550 
4551 -- | Same as 'difference'.
4552 (\\) :: Ord k => Map k a -> Map k b -> Map k a
4553hunk ./Data/Map.hs 340
4554             LT -> go k l
4555             GT -> go k r
4556             EQ -> Just x
4557+#if __GLASGOW_HASKELL__ >= 700
4558+{-# INLINABLE lookup #-}
4559+#else
4560 {-# INLINE lookup #-}
4561hunk ./Data/Map.hs 344
4562+#endif
4563 
4564 lookupAssoc :: Ord k => k -> Map k a -> Maybe (k,a)
4565 lookupAssoc = go
4566hunk ./Data/Map.hs 356
4567             LT -> go k l
4568             GT -> go k r
4569             EQ -> Just (kx,x)
4570+#if __GLASGOW_HASKELL__ >= 700
4571+{-# INLINEABLE lookupAssoc #-}
4572+#else
4573 {-# INLINE lookupAssoc #-}
4574hunk ./Data/Map.hs 360
4575+#endif
4576 
4577 -- | /O(log n)/. Is the key a member of the map? See also 'notMember'.
4578 --
4579hunk ./Data/Map.hs 371
4580 member k m = case lookup k m of
4581     Nothing -> False
4582     Just _  -> True
4583+#if __GLASGOW_HASKELL__ >= 700
4584+{-# INLINEABLE member #-}
4585+#else
4586 {-# INLINE member #-}
4587hunk ./Data/Map.hs 375
4588+#endif
4589 
4590 -- | /O(log n)/. Is the key not a member of the map? See also 'member'.
4591 --
4592hunk ./Data/Map.hs 395
4593     Just x  -> x
4594 #if __GLASGOW_HASKELL__ >= 700
4595 {-# INLINABLE find #-}
4596+#else
4597+{-# INLINE find #-}
4598 #endif
4599 
4600 -- | /O(log n)/. The expression @('findWithDefault' def k map)@ returns
4601hunk ./Data/Map.hs 412
4602     Just x  -> x
4603 #if __GLASGOW_HASKELL__ >= 700
4604 {-# INLINABLE findWithDefault #-}
4605+#else
4606+{-# INLINE findWithDefault #-}
4607 #endif
4608 
4609 {--------------------------------------------------------------------
4610hunk ./Data/Map.hs 426
4611 
4612 empty :: Map k a
4613 empty = Tip
4614-#if __GLASGOW_HASKELL__ >= 700
4615-{-# INLINABLE empty #-}
4616-#endif
4617+{-# INLINE empty #-}
4618 
4619 -- | /O(1)/. A map with a single element.
4620 --
4621hunk ./Data/Map.hs 435
4622 
4623 singleton :: k -> a -> Map k a
4624 singleton k x = Bin 1 k x Tip Tip
4625-#if __GLASGOW_HASKELL__ >= 700
4626-{-# INLINABLE singleton #-}
4627-#endif
4628+{-# INLINE singleton #-}
4629 
4630 {--------------------------------------------------------------------
4631   Insertion
4632hunk ./Data/Map.hs 459
4633             LT -> balanceL ky y (go kx x l) r
4634             GT -> balanceR ky y l (go kx x r)
4635             EQ -> Bin sz kx x l r
4636+#if __GLASGOW_HASKELL__ >= 700
4637+{-# INLINEABLE insert #-}
4638+#else
4639 {-# INLINE insert #-}
4640hunk ./Data/Map.hs 463
4641+#endif
4642 
4643 -- | /O(log n)/. Insert with a function, combining new value and old value.
4644 -- @'insertWith' f key value mp@
4645hunk ./Data/Map.hs 512
4646             LT -> balanceL ky y (go f kx x l) r
4647             GT -> balanceR ky y l (go f kx x r)
4648             EQ -> Bin sy kx (f kx x y) l r
4649+#if __GLASGOW_HASKELL__ >= 700
4650+{-# INLINEABLE insertWithKey #-}
4651+#else
4652 {-# INLINE insertWithKey #-}
4653hunk ./Data/Map.hs 516
4654+#endif
4655 
4656 -- | Same as 'insertWithKey', but the combining function is applied strictly.
4657 insertWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
4658hunk ./Data/Map.hs 529
4659             LT -> balanceL ky y (go f kx x l) r
4660             GT -> balanceR ky y l (go f kx x r)
4661             EQ -> let x' = f kx x y in x' `seq` (Bin sy kx x' l r)
4662+#if __GLASGOW_HASKELL__ >= 700
4663+{-# INLINEABLE insertWithKey' #-}
4664+#else
4665 {-# INLINE insertWithKey' #-}
4666hunk ./Data/Map.hs 533
4667+#endif
4668 
4669 -- | /O(log n)/. Combines insert operation with old value retrieval.
4670 -- The expression (@'insertLookupWithKey' f k x map@)
4671hunk ./Data/Map.hs 564
4672             GT -> let (found, r') = go f kx x r
4673                   in (found, balanceR ky y l r')
4674             EQ -> (Just y, Bin sy kx (f kx x y) l r)
4675+#if __GLASGOW_HASKELL__ >= 700
4676+{-# INLINEABLE insertLookupWithKey #-}
4677+#else
4678 {-# INLINE insertLookupWithKey #-}
4679hunk ./Data/Map.hs 568
4680+#endif
4681 
4682 -- | /O(log n)/. A strict version of 'insertLookupWithKey'.
4683 insertLookupWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a
4684hunk ./Data/Map.hs 584
4685             GT -> let (found, r') = go f kx x r
4686                   in (found, balanceR ky y l r')
4687             EQ -> let x' = f kx x y in x' `seq` (Just y, Bin sy kx x' l r)
4688+#if __GLASGOW_HASKELL__ >= 700
4689+{-# INLINEABLE insertLookupWithKey' #-}
4690+#else
4691 {-# INLINE insertLookupWithKey' #-}
4692hunk ./Data/Map.hs 588
4693+#endif
4694 
4695 {--------------------------------------------------------------------
4696   Deletion
4697hunk ./Data/Map.hs 611
4698             LT -> balanceR kx x (go k l) r
4699             GT -> balanceL kx x l (go k r)
4700             EQ -> glue l r
4701+#if __GLASGOW_HASKELL__ >= 700
4702+{-# INLINEABLE delete #-}
4703+#else
4704 {-# INLINE delete #-}
4705hunk ./Data/Map.hs 615
4706+#endif
4707 
4708 -- | /O(log n)/. Update a value at a specific key with the result of the provided function.
4709 -- When the key is not
4710hunk ./Data/Map.hs 676
4711            EQ -> case f kx x of
4712                    Just x' -> Bin sx kx x' l r
4713                    Nothing -> glue l r
4714+#if __GLASGOW_HASKELL__ >= 700
4715+{-# INLINEABLE updateWithKey #-}
4716+#else
4717 {-# INLINE updateWithKey #-}
4718hunk ./Data/Map.hs 680
4719+#endif
4720 
4721 -- | /O(log n)/. Lookup and update. See also 'updateWithKey'.
4722 -- The function returns changed value, if it is updated.
4723hunk ./Data/Map.hs 703
4724                EQ -> case f kx x of
4725                        Just x' -> (Just x',Bin sx kx x' l r)
4726                        Nothing -> (Just x,glue l r)
4727+#if __GLASGOW_HASKELL__ >= 700
4728+{-# INLINEABLE updateLookupWithKey #-}
4729+#else
4730 {-# INLINE updateLookupWithKey #-}
4731hunk ./Data/Map.hs 707
4732+#endif
4733 
4734 -- | /O(log n)/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof.
4735 -- 'alter' can be used to insert, delete, or update a value in a 'Map'.
4736hunk ./Data/Map.hs 735
4737                EQ -> case f (Just x) of
4738                        Just x' -> Bin sx kx x' l r
4739                        Nothing -> glue l r
4740+#if __GLASGOW_HASKELL__ >= 700
4741+{-# INLINEABLE alter #-}
4742+#else
4743 {-# INLINE alter #-}
4744hunk ./Data/Map.hs 739
4745+#endif
4746 
4747 {--------------------------------------------------------------------
4748   Indexing
4749hunk ./Data/Map.hs 1021
4750 -- Update the 1st component of a tuple (special case of Control.Arrow.first)
4751 first :: (a -> b) -> (a,c) -> (b,c)
4752 first f (x,y) = (f x, y)
4753-#if __GLASGOW_HASKELL__ >= 700
4754-{-# INLINABLE first #-}
4755-#endif
4756 
4757 {--------------------------------------------------------------------
4758   Union.
4759hunk ./Data/Map.hs 1099
4760 unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
4761 unionWith f m1 m2
4762   = unionWithKey (\_ x y -> f x y) m1 m2
4763-#if __GLASGOW_HASKELL__ >= 700
4764-{-# INLINABLE unionWith #-}
4765-#endif
4766+{-# INLINE unionWith #-}
4767 
4768 -- | /O(n+m)/.
4769 -- Union with a combining function. The implementation uses the efficient /hedge-union/ algorithm.
4770hunk ./Data/Map.hs 1186
4771 differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
4772 differenceWith f m1 m2
4773   = differenceWithKey (\_ x y -> f x y) m1 m2
4774-#if __GLASGOW_HASKELL__ >= 700
4775-{-# INLINABLE differenceWith #-}
4776-#endif
4777+{-# INLINE differenceWith #-}
4778 
4779 -- | /O(n+m)/. Difference with a combining function. When two equal keys are
4780 -- encountered, the combining function is applied to the key and both values.
4781hunk ./Data/Map.hs 1246
4782 intersection :: Ord k => Map k a -> Map k b -> Map k a
4783 intersection m1 m2
4784   = intersectionWithKey (\_ x _ -> x) m1 m2
4785-#if __GLASGOW_HASKELL__ >= 700
4786-{-# INLINABLE intersection #-}
4787-#endif
4788+{-# INLINE intersection #-}
4789 
4790 -- | /O(n+m)/. Intersection with a combining function.
4791 --
4792hunk ./Data/Map.hs 1255
4793 intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
4794 intersectionWith f m1 m2
4795   = intersectionWithKey (\_ x y -> f x y) m1 m2
4796-#if __GLASGOW_HASKELL__ >= 700
4797-{-# INLINABLE intersectionWith #-}
4798-#endif
4799+{-# INLINE intersectionWith #-}
4800 
4801 -- | /O(n+m)/. Intersection with a combining function.
4802 -- Intersection is more efficient on (bigset \``intersection`\` smallset).
4803hunk ./Data/Map.hs 2367
4804 bin :: k -> a -> Map k a -> Map k a -> Map k a
4805 bin k x l r
4806   = Bin (size l + size r + 1) k x l r
4807-#if __GLASGOW_HASKELL__ >= 700
4808-{-# INLINABLE bin #-}
4809-#endif
4810+{-# INLINE bin #-}
4811 
4812 
4813 {--------------------------------------------------------------------
4814hunk ./Data/Map.hs 2576
4815     STRICT23(go)
4816     go f z []     = z
4817     go f z (x:xs) = go f (f z x) xs
4818-#if __GLASGOW_HASKELL__ >= 700
4819-{-# INLINABLE foldlStrict #-}
4820-#endif
4821+{-# INLINE foldlStrict #-}
4822hunk ./Data/Set.hs 235
4823 -- | /O(1)/. The empty set.
4824 empty  :: Set a
4825 empty = Tip
4826-#if __GLASGOW_HASKELL__ >= 700
4827-{-# INLINABLE empty  #-}
4828-#endif
4829+{-# INLINE empty #-}
4830 
4831 -- | /O(1)/. Create a singleton set.
4832 singleton :: a -> Set a
4833hunk ./Data/Set.hs 240
4834 singleton x = Bin 1 x Tip Tip
4835-#if __GLASGOW_HASKELL__ >= 700
4836-{-# INLINABLE singleton #-}
4837-#endif
4838+{-# INLINE singleton #-}
4839 
4840 {--------------------------------------------------------------------
4841   Insertion, Deletion
4842hunk ./Data/Set.hs 257
4843         LT -> balanceL y (go x l) r
4844         GT -> balanceR y l (go x r)
4845         EQ -> Bin sz x l r
4846+#if __GLASGOW_HASKELL__ >= 700
4847+{-# INLINEABLE insert #-}
4848+#else
4849 {-# INLINE insert #-}
4850hunk ./Data/Set.hs 261
4851+#endif
4852 
4853 -- Insert an element to the set only if it is not in the set. Used by
4854 -- `union`.
4855hunk ./Data/Set.hs 274
4856         LT -> balanceL y (go x l) r
4857         GT -> balanceR y l (go x r)
4858         EQ -> t
4859+#if __GLASGOW_HASKELL__ >= 700
4860+{-# INLINEABLE insertR #-}
4861+#else
4862 {-# INLINE insertR #-}
4863hunk ./Data/Set.hs 278
4864+#endif
4865 
4866 -- | /O(log n)/. Delete an element from a set.
4867 delete :: Ord a => a -> Set a -> Set a
4868hunk ./Data/Set.hs 290
4869         LT -> balanceR y (go x l) r
4870         GT -> balanceL y l (go x r)
4871         EQ -> glue l r
4872+#if __GLASGOW_HASKELL__ >= 700
4873+{-# INLINEABLE delete #-}
4874+#else
4875 {-# INLINE delete #-}
4876hunk ./Data/Set.hs 294
4877+#endif
4878 
4879 {--------------------------------------------------------------------
4880   Subset
4881hunk ./Data/Set.hs 1061
4882 bin :: a -> Set a -> Set a -> Set a
4883 bin x l r
4884   = Bin (size l + size r + 1) x l r
4885-#if __GLASGOW_HASKELL__ >= 700
4886-{-# INLINABLE bin #-}
4887-#endif
4888+{-# INLINE bin #-}
4889 
4890 
4891 {--------------------------------------------------------------------
4892hunk ./Data/Set.hs 1073
4893     STRICT23(go)
4894     go f z []     = z
4895     go f z (x:xs) = go f (f z x) xs
4896-#if __GLASGOW_HASKELL__ >= 700
4897-{-# INLINABLE foldlStrict #-}
4898-#endif
4899+{-# INLINE foldlStrict #-}
4900 
4901 {--------------------------------------------------------------------
4902   Debugging
4903}
4904[Mark fold explicitely as INLINE.
4905Milan Straka <fox@ucw.cz>**20101016222150
4906 Ignore-this: b72855a0af39e57b1862908717fc14fc
4907 
4908 The INLINABLE does not work well in this case. Benchmarks
4909 show memory savings (due to unboxing) and nearly no GHC binary
4910 size increase.
4911] {
4912hunk ./Data/IntMap.hs 1595
4913 
4914 fold :: (a -> b -> b) -> b -> IntMap a -> b
4915 fold f = foldWithKey (\_ x y -> f x y)
4916-#if __GLASGOW_HASKELL__ >= 700
4917-{-# INLINABLE fold #-}
4918-#endif
4919+{-# INLINE fold #-}
4920 
4921 -- | /O(n)/. Fold the keys and values in the map, such that
4922 -- @'foldWithKey' f z == 'Prelude.foldr' ('uncurry' f) z . 'toAscList'@.
4923hunk ./Data/IntMap.hs 1609
4924 foldWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
4925 foldWithKey
4926   = foldr
4927-#if __GLASGOW_HASKELL__ >= 700
4928-{-# INLINABLE foldWithKey #-}
4929-#endif
4930+{-# INLINE foldWithKey #-}
4931 
4932 foldr :: (Key -> a -> b -> b) -> b -> IntMap a -> b
4933 foldr f z t
4934hunk ./Data/IntMap.hs 1614
4935   = case t of
4936-      Bin 0 m l r | m < 0 -> foldr' f (foldr' f z l) r  -- put negative numbers before.
4937-      Bin _ _ _ _ -> foldr' f z t
4938+      Bin 0 m l r | m < 0 -> go f (go f z l) r  -- put negative numbers before.
4939+      Bin _ _ _ _ -> go f z t
4940       Tip k x     -> f k x z
4941       Nil         -> z
4942hunk ./Data/IntMap.hs 1618
4943-#if __GLASGOW_HASKELL__ >= 700
4944-{-# INLINABLE foldr #-}
4945-#endif
4946-
4947-foldr' :: (Key -> a -> b -> b) -> b -> IntMap a -> b
4948-foldr' = go
4949   where
4950     go f z (Bin _ _ l r) = go f (go f z r) l
4951     go f z (Tip k x)     = f k x z
4952hunk ./Data/IntMap.hs 1622
4953     go f z Nil           = z
4954-#if __GLASGOW_HASKELL__ >= 700
4955-{-# INLINABLE foldr' #-}
4956-#endif
4957+{-# INLINE foldr #-}
4958+
4959 
4960 {--------------------------------------------------------------------
4961   List variations
4962hunk ./Data/IntSet.hs 754
4963 fold :: (Int -> b -> b) -> b -> IntSet -> b
4964 fold f z t
4965   = case t of
4966-      Bin 0 m l r | m < 0 -> foldr f (foldr f z l) r 
4967-      -- put negative numbers before.
4968-      Bin _ _ _ _ -> foldr f z t
4969+      Bin 0 m l r | m < 0 -> go f (go f z l) r  -- put negative numbers before.
4970+      Bin _ _ _ _ -> go f z t
4971       Tip x       -> f x z
4972       Nil         -> z
4973hunk ./Data/IntSet.hs 758
4974-#if __GLASGOW_HASKELL__ >= 700
4975-{-# INLINABLE fold #-}
4976-#endif
4977-
4978-foldr :: (Int -> b -> b) -> b -> IntSet -> b
4979-foldr f z t
4980-  = case t of
4981-      Bin _ _ l r -> foldr f (foldr f z r) l
4982-      Tip x       -> f x z
4983-      Nil         -> z
4984-#if __GLASGOW_HASKELL__ >= 700
4985-{-# INLINABLE foldr #-}
4986-#endif
4987+  where
4988+    go f z (Bin _ _ l r) = go f (go f z r) l
4989+    go f z (Tip x)       = f x z
4990+    go f z Nil           = z
4991+{-# INLINE fold #-}
4992 
4993 {--------------------------------------------------------------------
4994   List variations
4995hunk ./Data/Map.hs 1660
4996 -- > fold f 0 (fromList [(5,"a"), (3,"bbb")]) == 4
4997 fold :: (a -> b -> b) -> b -> Map k a -> b
4998 fold f = foldWithKey (\_ x' z' -> f x' z')
4999-#if __GLASGOW_HASKELL__ >= 700
5000-{-# INLINABLE fold #-}
5001-#endif
5002+{-# INLINE fold #-}
5003 
5004 -- | /O(n)/. Fold the keys and values in the map, such that
5005 -- @'foldWithKey' f z == 'Prelude.foldr' ('uncurry' f) z . 'toAscList'@.
5006hunk ./Data/Map.hs 1676
5007 foldWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b
5008 foldWithKey = foldrWithKey
5009 {-# DEPRECATED foldWithKey "Use foldrWithKey instead" #-}
5010-#if __GLASGOW_HASKELL__ >= 700
5011-{-# INLINABLE foldWithKey #-}
5012-#endif
5013+{-# INLINE foldWithKey #-}
5014 
5015 -- | /O(n)/. Post-order fold.  The function will be applied from the lowest
5016 -- value to the highest.
5017hunk ./Data/Map.hs 1685
5018   where
5019     go f z Tip              = z
5020     go f z (Bin _ kx x l r) = go f (f kx x (go f z r)) l
5021-#if __GLASGOW_HASKELL__ >= 700
5022-{-# INLINABLE foldrWithKey #-}
5023-#endif
5024+{-# INLINE foldrWithKey #-}
5025 
5026 -- | /O(n)/. Pre-order fold.  The function will be applied from the highest
5027 -- value to the lowest.
5028hunk ./Data/Map.hs 1694
5029   where
5030     go f z Tip              = z
5031     go f z (Bin _ kx x l r) = go f (f (go f z l) kx x) r
5032-#if __GLASGOW_HASKELL__ >= 700
5033-{-# INLINABLE foldlWithKey #-}
5034-#endif
5035+{-# INLINE foldlWithKey #-}
5036 
5037 {-
5038 -- | /O(n)/. A strict version of 'foldlWithKey'.
5039hunk ./Data/Set.hs 540
5040 -- | /O(n)/. Fold over the elements of a set in an unspecified order.
5041 fold :: (a -> b -> b) -> b -> Set a -> b
5042 fold = foldr
5043-#if __GLASGOW_HASKELL__ >= 700
5044-{-# INLINABLE fold #-}
5045-#endif
5046+{-# INLINE fold #-}
5047 
5048 -- | /O(n)/. Post-order fold.
5049 foldr :: (a -> b -> b) -> b -> Set a -> b
5050hunk ./Data/Set.hs 548
5051   where
5052     go f z Tip           = z
5053     go f z (Bin _ x l r) = go f (f x (go f z r)) l
5054-#if __GLASGOW_HASKELL__ >= 700
5055-{-# INLINABLE foldr #-}
5056-#endif
5057+{-# INLINE foldr #-}
5058 
5059 {--------------------------------------------------------------------
5060   List variations
5061}
5062[Do not pass f explicitely for fold.
5063Milan Straka <fox@ucw.cz>**20101019202043
5064 Ignore-this: bb0a5e758ebfebbdf8160be4317898e9
5065 
5066 Benchmarks shows this is a huge win (100% for (:) being
5067 the function, 1000% for (+) being the function).
5068] {
5069hunk ./Data/IntMap.hs 1614
5070 foldr :: (Key -> a -> b -> b) -> b -> IntMap a -> b
5071 foldr f z t
5072   = case t of
5073-      Bin 0 m l r | m < 0 -> go f (go f z l) r  -- put negative numbers before.
5074-      Bin _ _ _ _ -> go f z t
5075+      Bin 0 m l r | m < 0 -> go (go z l) r  -- put negative numbers before.
5076+      Bin _ _ _ _ -> go z t
5077       Tip k x     -> f k x z
5078       Nil         -> z
5079   where
5080hunk ./Data/IntMap.hs 1619
5081-    go f z (Bin _ _ l r) = go f (go f z r) l
5082-    go f z (Tip k x)     = f k x z
5083-    go f z Nil           = z
5084+    go z (Bin _ _ l r) = go (go z r) l
5085+    go z (Tip k x)     = f k x z
5086+    go z Nil           = z
5087 {-# INLINE foldr #-}
5088 
5089 
5090hunk ./Data/IntSet.hs 754
5091 fold :: (Int -> b -> b) -> b -> IntSet -> b
5092 fold f z t
5093   = case t of
5094-      Bin 0 m l r | m < 0 -> go f (go f z l) r  -- put negative numbers before.
5095-      Bin _ _ _ _ -> go f z t
5096+      Bin 0 m l r | m < 0 -> go (go z l) r  -- put negative numbers before.
5097+      Bin _ _ _ _ -> go z t
5098       Tip x       -> f x z
5099       Nil         -> z
5100   where
5101hunk ./Data/IntSet.hs 759
5102-    go f z (Bin _ _ l r) = go f (go f z r) l
5103-    go f z (Tip x)       = f x z
5104-    go f z Nil           = z
5105+    go z (Bin _ _ l r) = go (go z r) l
5106+    go z (Tip x)       = f x z
5107+    go z Nil           = z
5108 {-# INLINE fold #-}
5109 
5110 {--------------------------------------------------------------------
5111hunk ./Data/Map.hs 1681
5112 -- | /O(n)/. Post-order fold.  The function will be applied from the lowest
5113 -- value to the highest.
5114 foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b
5115-foldrWithKey = go
5116+foldrWithKey f = go
5117   where
5118hunk ./Data/Map.hs 1683
5119-    go f z Tip              = z
5120-    go f z (Bin _ kx x l r) = go f (f kx x (go f z r)) l
5121+    go z Tip              = z
5122+    go z (Bin _ kx x l r) = go (f kx x (go z r)) l
5123 {-# INLINE foldrWithKey #-}
5124 
5125 -- | /O(n)/. Pre-order fold.  The function will be applied from the highest
5126hunk ./Data/Map.hs 1690
5127 -- value to the lowest.
5128 foldlWithKey :: (b -> k -> a -> b) -> b -> Map k a -> b
5129-foldlWithKey = go
5130+foldlWithKey f = go
5131   where
5132hunk ./Data/Map.hs 1692
5133-    go f z Tip              = z
5134-    go f z (Bin _ kx x l r) = go f (f (go f z l) kx x) r
5135+    go z Tip              = z
5136+    go z (Bin _ kx x l r) = go (f (go z l) kx x) r
5137 {-# INLINE foldlWithKey #-}
5138 
5139 {-
5140hunk ./Data/Set.hs 544
5141 
5142 -- | /O(n)/. Post-order fold.
5143 foldr :: (a -> b -> b) -> b -> Set a -> b
5144-foldr = go
5145+foldr f = go
5146   where
5147hunk ./Data/Set.hs 546
5148-    go f z Tip           = z
5149-    go f z (Bin _ x l r) = go f (f x (go f z r)) l
5150+    go z Tip           = z
5151+    go z (Bin _ x l r) = go (f x (go z r)) l
5152 {-# INLINE foldr #-}
5153 
5154 {--------------------------------------------------------------------
5155}
5156[Remove INLINABLE in IntMap and IntSet.hs.
5157Milan Straka <fox@ucw.cz>**20101022091744
5158 Ignore-this: 4f532887bf54444989cc66d6546f1c89
5159 
5160 It makes no sense, as the calls are already specialized
5161 for Int keys. Benchmarks actually show small slowdown.
5162] {
5163hunk ./Data/IntMap.hs 245
5164 
5165 (!) :: IntMap a -> Key -> a
5166 m ! k    = find k m
5167-#if __GLASGOW_HASKELL__ >= 700
5168-{-# INLINABLE (!) #-}
5169-#endif
5170 
5171 -- | Same as 'difference'.
5172 (\\) :: IntMap a -> IntMap b -> IntMap a
5173hunk ./Data/IntMap.hs 249
5174 m1 \\ m2 = difference m1 m2
5175-#if __GLASGOW_HASKELL__ >= 700
5176-{-# INLINABLE (\\) #-}
5177-#endif
5178 
5179 {--------------------------------------------------------------------
5180   Types 
5181hunk ./Data/IntMap.hs 306
5182 null :: IntMap a -> Bool
5183 null Nil = True
5184 null _   = False
5185-#if __GLASGOW_HASKELL__ >= 700
5186-{-# INLINABLE null #-}
5187-#endif
5188 
5189 -- | /O(n)/. Number of elements in the map.
5190 --
5191hunk ./Data/IntMap.hs 318
5192       Bin _ _ l r -> size l + size r
5193       Tip _ _ -> 1
5194       Nil     -> 0
5195-#if __GLASGOW_HASKELL__ >= 700
5196-{-# INLINABLE size #-}
5197-#endif
5198 
5199 -- | /O(min(n,W))/. Is the key a member of the map?
5200 --
5201hunk ./Data/IntMap.hs 329
5202   = case lookup k m of
5203       Nothing -> False
5204       Just _  -> True
5205-#if __GLASGOW_HASKELL__ >= 700
5206-{-# INLINABLE member #-}
5207-#endif
5208 
5209 -- | /O(log n)/. Is the key not a member of the map?
5210 --
5211hunk ./Data/IntMap.hs 337
5212 
5213 notMember :: Key -> IntMap a -> Bool
5214 notMember k m = not $ member k m
5215-#if __GLASGOW_HASKELL__ >= 700
5216-{-# INLINABLE notMember #-}
5217-#endif
5218 
5219 -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'.
5220 lookup :: Key -> IntMap a -> Maybe a
5221hunk ./Data/IntMap.hs 358
5222   = case lookup k m of
5223       Nothing -> error ("IntMap.find: key " ++ show k ++ " is not an element of the map")
5224       Just x  -> x
5225-#if __GLASGOW_HASKELL__ >= 700
5226-{-# INLINABLE find #-}
5227-#endif
5228 
5229 -- | /O(min(n,W))/. The expression @('findWithDefault' def k map)@
5230 -- returns the value at key @k@ or returns @def@ when the key is not an
5231hunk ./Data/IntMap.hs 371
5232   = case lookup k m of
5233       Nothing -> def
5234       Just x  -> x
5235-#if __GLASGOW_HASKELL__ >= 700
5236-{-# INLINABLE findWithDefault #-}
5237-#endif
5238 
5239 {--------------------------------------------------------------------
5240   Construction
5241hunk ./Data/IntMap.hs 418
5242           | k==ky         = Tip k x
5243           | otherwise     = join k (Tip k x) ky t
5244         go k x Nil            = Tip k x
5245-#if __GLASGOW_HASKELL__ >= 700
5246-{-# INLINABLE insert #-}
5247-#endif
5248 
5249 -- right-biased insertion, used by 'union'
5250 -- | /O(min(n,W))/. Insert with a combining function.
5251hunk ./Data/IntMap.hs 433
5252 insertWith :: (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
5253 insertWith f k x t
5254   = insertWithKey (\_ x' y' -> f x' y') k x t
5255-#if __GLASGOW_HASKELL__ >= 700
5256-{-# INLINABLE insertWith #-}
5257-#endif
5258 
5259 -- | /O(min(n,W))/. Insert with a combining function.
5260 -- @'insertWithKey' f key value mp@
5261hunk ./Data/IntMap.hs 459
5262         | otherwise     = join k (Tip k x) ky t
5263 
5264     go _ k x Nil = Tip k x
5265-#if __GLASGOW_HASKELL__ >= 700
5266-{-# INLINABLE insertWithKey #-}
5267-#endif
5268 
5269 
5270 -- | /O(min(n,W))/. The expression (@'insertLookupWithKey' f k x map@)
5271hunk ./Data/IntMap.hs 490
5272         | otherwise     = (Nothing,join k (Tip k x) ky t)
5273 
5274       go _ k x Nil = (Nothing,Tip k x)
5275-#if __GLASGOW_HASKELL__ >= 700
5276-{-# INLINABLE insertLookupWithKey #-}
5277-#endif
5278 
5279 
5280 {--------------------------------------------------------------------
5281hunk ./Data/IntMap.hs 531
5282 adjust ::  (a -> a) -> Key -> IntMap a -> IntMap a
5283 adjust f k m
5284   = adjustWithKey (\_ x -> f x) k m
5285-#if __GLASGOW_HASKELL__ >= 700
5286-{-# INLINABLE adjust #-}
5287-#endif
5288 
5289 -- | /O(min(n,W))/. Adjust a value at a specific key. When the key is not
5290 -- a member of the map, the original map is returned.
5291hunk ./Data/IntMap.hs 543
5292 adjustWithKey ::  (Key -> a -> a) -> Key -> IntMap a -> IntMap a
5293 adjustWithKey f
5294   = updateWithKey (\k' x -> Just (f k' x))
5295-#if __GLASGOW_HASKELL__ >= 700
5296-{-# INLINABLE adjustWithKey #-}
5297-#endif
5298 
5299 -- | /O(min(n,W))/. The expression (@'update' f k map@) updates the value @x@
5300 -- at @k@ (if it is in the map). If (@f x@) is 'Nothing', the element is
5301hunk ./Data/IntMap.hs 556
5302 update ::  (a -> Maybe a) -> Key -> IntMap a -> IntMap a
5303 update f
5304   = updateWithKey (\_ x -> f x)
5305-#if __GLASGOW_HASKELL__ >= 700
5306-{-# INLINABLE update #-}
5307-#endif
5308 
5309 -- | /O(min(n,W))/. The expression (@'update' f k map@) updates the value @x@
5310 -- at @k@ (if it is in the map). If (@f k x@) is 'Nothing', the element is
5311hunk ./Data/IntMap.hs 582
5312         | otherwise     = t
5313 
5314       go _ _ Nil = Nil
5315-#if __GLASGOW_HASKELL__ >= 700
5316-{-# INLINABLE updateWithKey #-}
5317-#endif
5318 
5319 -- | /O(min(n,W))/. Lookup and update.
5320 -- The function returns original value, if it is updated.
5321hunk ./Data/IntMap.hs 609
5322         | otherwise     = (Nothing,t)
5323 
5324       go _ _ Nil = (Nothing,Nil)
5325-#if __GLASGOW_HASKELL__ >= 700
5326-{-# INLINABLE updateLookupWithKey #-}
5327-#endif
5328 
5329 -- | /O(log n)/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof.
5330 -- 'alter' can be used to insert, delete, or update a value in an 'IntMap'.
5331hunk ./Data/IntMap.hs 636
5332     go f k Nil              = case f Nothing of
5333                              Just x -> Tip k x
5334                              Nothing -> Nil
5335-#if __GLASGOW_HASKELL__ >= 700
5336-{-# INLINABLE alter #-}
5337-#endif
5338 
5339 
5340 {--------------------------------------------------------------------
5341hunk ./Data/IntMap.hs 651
5342 unions :: [IntMap a] -> IntMap a
5343 unions xs
5344   = foldlStrict union empty xs
5345-#if __GLASGOW_HASKELL__ >= 700
5346-{-# INLINABLE unions #-}
5347-#endif
5348 
5349 -- | The union of a list of maps, with a combining operation.
5350 --
5351hunk ./Data/IntMap.hs 660
5352 unionsWith :: (a->a->a) -> [IntMap a] -> IntMap a
5353 unionsWith f ts
5354   = foldlStrict (unionWith f) empty ts
5355-#if __GLASGOW_HASKELL__ >= 700
5356-{-# INLINABLE unionsWith #-}
5357-#endif
5358 
5359 -- | /O(n+m)/. The (left-biased) union of two maps.
5360 -- It prefers the first map when duplicate keys are encountered,
5361hunk ./Data/IntMap.hs 686
5362 union t (Tip k x) = insertWith (\_ y -> y) k x t  -- right bias
5363 union Nil t       = t
5364 union t Nil       = t
5365-#if __GLASGOW_HASKELL__ >= 700
5366-{-# INLINABLE union #-}
5367-#endif
5368 
5369 -- | /O(n+m)/. The union with a combining function.
5370 --
5371hunk ./Data/IntMap.hs 694
5372 unionWith :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a
5373 unionWith f m1 m2
5374   = unionWithKey (\_ x y -> f x y) m1 m2
5375-#if __GLASGOW_HASKELL__ >= 700
5376-{-# INLINABLE unionWith #-}
5377-#endif
5378 
5379 -- | /O(n+m)/. The union with a combining function.
5380 --
5381hunk ./Data/IntMap.hs 719
5382 unionWithKey f t (Tip k x) = insertWithKey (\k' x' y' -> f k' y' x') k x t  -- right bias
5383 unionWithKey _ Nil t  = t
5384 unionWithKey _ t Nil  = t
5385-#if __GLASGOW_HASKELL__ >= 700
5386-{-# INLINABLE unionWithKey #-}
5387-#endif
5388 
5389 {--------------------------------------------------------------------
5390   Difference
5391hunk ./Data/IntMap.hs 749
5392 difference Nil _       = Nil
5393 difference t (Tip k _) = delete k t
5394 difference t Nil       = t
5395-#if __GLASGOW_HASKELL__ >= 700
5396-{-# INLINABLE difference #-}
5397-#endif
5398 
5399 -- | /O(n+m)/. Difference with a combining function.
5400 --
5401hunk ./Data/IntMap.hs 759
5402 differenceWith :: (a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMap a
5403 differenceWith f m1 m2
5404   = differenceWithKey (\_ x y -> f x y) m1 m2
5405-#if __GLASGOW_HASKELL__ >= 700
5406-{-# INLINABLE differenceWith #-}
5407-#endif
5408 
5409 -- | /O(n+m)/. Difference with a combining function. When two equal keys are
5410 -- encountered, the combining function is applied to the key and both values.
5411hunk ./Data/IntMap.hs 794
5412 differenceWithKey _ Nil _       = Nil
5413 differenceWithKey f t (Tip k y) = updateWithKey (\k' x -> f k' x y) k t
5414 differenceWithKey _ t Nil       = t
5415-#if __GLASGOW_HASKELL__ >= 700
5416-{-# INLINABLE differenceWithKey #-}
5417-#endif
5418 
5419 
5420 {--------------------------------------------------------------------
5421hunk ./Data/IntMap.hs 827
5422       Nothing -> Nil
5423 intersection Nil _ = Nil
5424 intersection _ Nil = Nil
5425-#if __GLASGOW_HASKELL__ >= 700
5426-{-# INLINABLE intersection #-}
5427-#endif
5428 
5429 -- | /O(n+m)/. The intersection with a combining function.
5430 --
5431hunk ./Data/IntMap.hs 835
5432 intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
5433 intersectionWith f m1 m2
5434   = intersectionWithKey (\_ x y -> f x y) m1 m2
5435-#if __GLASGOW_HASKELL__ >= 700
5436-{-# INLINABLE intersectionWith #-}
5437-#endif
5438 
5439 -- | /O(n+m)/. The intersection with a combining function.
5440 --
5441hunk ./Data/IntMap.hs 866
5442       Nothing -> Nil
5443 intersectionWithKey _ Nil _ = Nil
5444 intersectionWithKey _ _ Nil = Nil
5445-#if __GLASGOW_HASKELL__ >= 700
5446-{-# INLINABLE intersectionWithKey #-}
5447-#endif
5448 
5449 
5450 {--------------------------------------------------------------------
5451hunk ./Data/IntMap.hs 884
5452      go f (Bin p m l r)         = let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
5453      go f (Tip k y) = Tip k (f k y)
5454      go f Nil       = error "maxView: empty map has no maximal element"
5455-#if __GLASGOW_HASKELL__ >= 700
5456-{-# INLINABLE updateMinWithKey #-}
5457-#endif
5458 
5459 updateMinWithKeyUnsigned :: (Key -> a -> a) -> IntMap a -> IntMap a
5460 updateMinWithKeyUnsigned = go
5461hunk ./Data/IntMap.hs 891
5462      go f (Bin p m l r) = let t' = go f l in Bin p m t' r
5463      go f (Tip k y)     = Tip k (f k y)
5464      go f Nil           = error "updateMinWithKeyUnsigned Nil"
5465-#if __GLASGOW_HASKELL__ >= 700
5466-{-# INLINABLE updateMinWithKeyUnsigned #-}
5467-#endif
5468 
5469 -- | /O(log n)/. Update the value at the maximal key.
5470 --
5471hunk ./Data/IntMap.hs 904
5472     go f (Bin p m l r)         = let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
5473     go f (Tip k y)        = Tip k (f k y)
5474     go f Nil              = error "maxView: empty map has no maximal element"
5475-#if __GLASGOW_HASKELL__ >= 700
5476-{-# INLINABLE updateMaxWithKey #-}
5477-#endif
5478 
5479 updateMaxWithKeyUnsigned :: (Key -> a -> a) -> IntMap a -> IntMap a
5480 updateMaxWithKeyUnsigned = go
5481hunk ./Data/IntMap.hs 911
5482     go f (Bin p m l r) = let t' = go f r in Bin p m l t'
5483     go f (Tip k y)     = Tip k (f k y)
5484     go f Nil           = error "updateMaxWithKeyUnsigned Nil"
5485-#if __GLASGOW_HASKELL__ >= 700
5486-{-# INLINABLE updateMaxWithKeyUnsigned #-}
5487-#endif
5488 
5489 
5490 -- | /O(log n)/. Retrieves the maximal (key,value) pair of the map, and
5491hunk ./Data/IntMap.hs 926
5492         Bin p m l r         -> let (result, t') = maxViewUnsigned r in Just (result, bin p m l t')
5493         Tip k y -> Just ((k,y), Nil)
5494         Nil -> Nothing
5495-#if __GLASGOW_HASKELL__ >= 700
5496-{-# INLINABLE maxViewWithKey #-}
5497-#endif
5498 
5499 maxViewUnsigned :: IntMap a -> ((Key, a), IntMap a)
5500 maxViewUnsigned t
5501hunk ./Data/IntMap.hs 933
5502         Bin p m l r -> let (result,t') = maxViewUnsigned r in (result,bin p m l t')
5503         Tip k y -> ((k,y), Nil)
5504         Nil -> error "maxViewUnsigned Nil"
5505-#if __GLASGOW_HASKELL__ >= 700
5506-{-# INLINABLE maxViewUnsigned #-}
5507-#endif
5508 
5509 -- | /O(log n)/. Retrieves the minimal (key,value) pair of the map, and
5510 -- the map stripped of that element, or 'Nothing' if passed an empty map.
5511hunk ./Data/IntMap.hs 947
5512         Bin p m l r         -> let (result, t') = minViewUnsigned l in Just (result, bin p m t' r)
5513         Tip k y -> Just ((k,y),Nil)
5514         Nil -> Nothing
5515-#if __GLASGOW_HASKELL__ >= 700
5516-{-# INLINABLE minViewWithKey #-}
5517-#endif
5518 
5519 minViewUnsigned :: IntMap a -> ((Key, a), IntMap a)
5520 minViewUnsigned t
5521hunk ./Data/IntMap.hs 954
5522         Bin p m l r -> let (result,t') = minViewUnsigned l in (result,bin p m t' r)
5523         Tip k y -> ((k,y),Nil)
5524         Nil -> error "minViewUnsigned Nil"
5525-#if __GLASGOW_HASKELL__ >= 700
5526-{-# INLINABLE minViewUnsigned #-}
5527-#endif
5528 
5529 
5530 -- | /O(log n)/. Update the value at the maximal key.
5531hunk ./Data/IntMap.hs 963
5532 
5533 updateMax :: (a -> a) -> IntMap a -> IntMap a
5534 updateMax f = updateMaxWithKey (const f)
5535-#if __GLASGOW_HASKELL__ >= 700
5536-{-# INLINABLE updateMax #-}
5537-#endif
5538 
5539 -- | /O(log n)/. Update the value at the minimal key.
5540 --
5541hunk ./Data/IntMap.hs 971
5542 
5543 updateMin :: (a -> a) -> IntMap a -> IntMap a
5544 updateMin f = updateMinWithKey (const f)
5545-#if __GLASGOW_HASKELL__ >= 700
5546-{-# INLINABLE updateMin #-}
5547-#endif
5548 
5549 -- Similar to the Arrow instance.
5550 first :: (a -> c) -> (a, b) -> (c, b)
5551hunk ./Data/IntMap.hs 975
5552 first f (x,y) = (f x,y)
5553-#if __GLASGOW_HASKELL__ >= 700
5554-{-# INLINABLE first #-}
5555-#endif
5556 
5557 -- | /O(log n)/. Retrieves the maximal key of the map, and the map
5558 -- stripped of that element, or 'Nothing' if passed an empty map.
5559hunk ./Data/IntMap.hs 980
5560 maxView :: IntMap a -> Maybe (a, IntMap a)
5561 maxView t = liftM (first snd) (maxViewWithKey t)
5562-#if __GLASGOW_HASKELL__ >= 700
5563-{-# INLINABLE maxView #-}
5564-#endif
5565 
5566 -- | /O(log n)/. Retrieves the minimal key of the map, and the map
5567 -- stripped of that element, or 'Nothing' if passed an empty map.
5568hunk ./Data/IntMap.hs 985
5569 minView :: IntMap a -> Maybe (a, IntMap a)
5570 minView t = liftM (first snd) (minViewWithKey t)
5571-#if __GLASGOW_HASKELL__ >= 700
5572-{-# INLINABLE minView #-}
5573-#endif
5574 
5575 -- | /O(log n)/. Delete and find the maximal element.
5576 deleteFindMax :: IntMap a -> (a, IntMap a)
5577hunk ./Data/IntMap.hs 989
5578 deleteFindMax = fromMaybe (error "deleteFindMax: empty map has no maximal element") . maxView
5579-#if __GLASGOW_HASKELL__ >= 700
5580-{-# INLINABLE deleteFindMax #-}
5581-#endif
5582 
5583 -- | /O(log n)/. Delete and find the minimal element.
5584 deleteFindMin :: IntMap a -> (a, IntMap a)
5585hunk ./Data/IntMap.hs 993
5586 deleteFindMin = fromMaybe (error "deleteFindMin: empty map has no minimal element") . minView
5587-#if __GLASGOW_HASKELL__ >= 700
5588-{-# INLINABLE deleteFindMin #-}
5589-#endif
5590 
5591 -- | /O(log n)/. The minimal key of the map.
5592 findMin :: IntMap a -> (Int,a)
5593hunk ./Data/IntMap.hs 1004
5594     where go (Tip k v)      = (k,v)
5595           go (Bin _ _ l' _) = go l'
5596           go Nil            = error "findMax Nil"
5597-#if __GLASGOW_HASKELL__ >= 700
5598-{-# INLINABLE findMin #-}
5599-#endif
5600 
5601 -- | /O(log n)/. The maximal key of the map.
5602 findMax :: IntMap a -> (Int,a)
5603hunk ./Data/IntMap.hs 1015
5604     where go (Tip k v)      = (k,v)
5605           go (Bin _ _ _ r') = go r'
5606           go Nil            = error "findMax Nil"
5607-#if __GLASGOW_HASKELL__ >= 700
5608-{-# INLINABLE findMax #-}
5609-#endif
5610 
5611 -- | /O(log n)/. Delete the minimal key. An error is thrown if the IntMap is already empty.
5612 -- Note, this is not the same behavior Map.
5613hunk ./Data/IntMap.hs 1020
5614 deleteMin :: IntMap a -> IntMap a
5615 deleteMin = maybe (error "deleteMin: empty map has no minimal element") snd . minView
5616-#if __GLASGOW_HASKELL__ >= 700
5617-{-# INLINABLE deleteMin #-}
5618-#endif
5619 
5620 -- | /O(log n)/. Delete the maximal key. An error is thrown if the IntMap is already empty.
5621 -- Note, this is not the same behavior Map.
5622hunk ./Data/IntMap.hs 1025
5623 deleteMax :: IntMap a -> IntMap a
5624 deleteMax = maybe (error "deleteMax: empty map has no maximal element") snd . maxView
5625-#if __GLASGOW_HASKELL__ >= 700
5626-{-# INLINABLE deleteMax #-}
5627-#endif
5628 
5629 
5630 {--------------------------------------------------------------------
5631hunk ./Data/IntMap.hs 1035
5632 isProperSubmapOf :: Eq a => IntMap a -> IntMap a -> Bool
5633 isProperSubmapOf m1 m2
5634   = isProperSubmapOfBy (==) m1 m2
5635-#if __GLASGOW_HASKELL__ >= 700
5636-{-# INLINABLE isProperSubmapOf #-}
5637-#endif
5638 
5639 {- | /O(n+m)/. Is this a proper submap? (ie. a submap but not equal).
5640  The expression (@'isProperSubmapOfBy' f m1 m2@) returns 'True' when
5641hunk ./Data/IntMap.hs 1057
5642   = case submapCmp predicate t1 t2 of
5643       LT -> True
5644       _  -> False
5645-#if __GLASGOW_HASKELL__ >= 700
5646-{-# INLINABLE isProperSubmapOfBy #-}
5647-#endif
5648 
5649 submapCmp :: (a -> b -> Bool) -> IntMap a -> IntMap b -> Ordering
5650 submapCmp predicate t1@(Bin p1 m1 l1 r1) (Bin p2 m2 l2 r2)
5651hunk ./Data/IntMap.hs 1084
5652      _                      -> GT -- disjoint
5653 submapCmp _    Nil Nil = EQ
5654 submapCmp _    Nil _   = LT
5655-#if __GLASGOW_HASKELL__ >= 700
5656-{-# INLINABLE submapCmp #-}
5657-#endif
5658 
5659 -- | /O(n+m)/. Is this a submap?
5660 -- Defined as (@'isSubmapOf' = 'isSubmapOfBy' (==)@).
5661hunk ./Data/IntMap.hs 1090
5662 isSubmapOf :: Eq a => IntMap a -> IntMap a -> Bool
5663 isSubmapOf m1 m2
5664   = isSubmapOfBy (==) m1 m2
5665-#if __GLASGOW_HASKELL__ >= 700
5666-{-# INLINABLE isSubmapOf #-}
5667-#endif
5668 
5669 {- | /O(n+m)/.
5670  The expression (@'isSubmapOfBy' f m1 m2@) returns 'True' if
5671hunk ./Data/IntMap.hs 1118
5672                                          Just y  -> predicate x y
5673                                          Nothing -> False
5674 isSubmapOfBy _         Nil _           = True
5675-#if __GLASGOW_HASKELL__ >= 700
5676-{-# INLINABLE isSubmapOfBy #-}
5677-#endif
5678 
5679 {--------------------------------------------------------------------
5680   Mapping
5681hunk ./Data/IntMap.hs 1128
5682 
5683 map :: (a -> b) -> IntMap a -> IntMap b
5684 map f = mapWithKey (\_ x -> f x)
5685-#if __GLASGOW_HASKELL__ >= 700
5686-{-# INLINABLE map #-}
5687-#endif
5688 
5689 -- | /O(n)/. Map a function over all values in the map.
5690 --
5691hunk ./Data/IntMap.hs 1140
5692    go f (Bin p m l r) = Bin p m (go f l) (go f r)
5693    go f (Tip k x)     = Tip k (f k x)
5694    go f Nil           = Nil
5695-#if __GLASGOW_HASKELL__ >= 700
5696-{-# INLINABLE mapWithKey #-}
5697-#endif
5698 
5699 -- | /O(n)/. The function @'mapAccum'@ threads an accumulating
5700 -- argument through the map in ascending order of keys.
5701hunk ./Data/IntMap.hs 1149
5702 
5703 mapAccum :: (a -> b -> (a,c)) -> a -> IntMap b -> (a,IntMap c)
5704 mapAccum f = mapAccumWithKey (\a' _ x -> f a' x)
5705-#if __GLASGOW_HASKELL__ >= 700
5706-{-# INLINABLE mapAccum #-}
5707-#endif
5708 
5709 -- | /O(n)/. The function @'mapAccumWithKey'@ threads an accumulating
5710 -- argument through the map in ascending order of keys.
5711hunk ./Data/IntMap.hs 1159
5712 mapAccumWithKey :: (a -> Key -> b -> (a,c)) -> a -> IntMap b -> (a,IntMap c)
5713 mapAccumWithKey f a t
5714   = mapAccumL f a t
5715-#if __GLASGOW_HASKELL__ >= 700
5716-{-# INLINABLE mapAccumWithKey #-}
5717-#endif
5718 
5719 -- | /O(n)/. The function @'mapAccumL'@ threads an accumulating
5720 -- argument through the map in ascending order of keys.
5721hunk ./Data/IntMap.hs 1170
5722                      in (a2,Bin p m l' r')
5723       Tip k x     -> let (a',x') = f a k x in (a',Tip k x')
5724       Nil         -> (a,Nil)
5725-#if __GLASGOW_HASKELL__ >= 700
5726-{-# INLINABLE mapAccumL #-}
5727-#endif
5728 
5729 -- | /O(n)/. The function @'mapAccumR'@ threads an accumulating
5730 -- argument through the map in descending order of keys.
5731hunk ./Data/IntMap.hs 1181
5732                      in (a2,Bin p m l' r')
5733       Tip k x     -> let (a',x') = f a k x in (a',Tip k x')
5734       Nil         -> (a,Nil)
5735-#if __GLASGOW_HASKELL__ >= 700
5736-{-# INLINABLE mapAccumRWithKey #-}
5737-#endif
5738 
5739 {--------------------------------------------------------------------
5740   Filter
5741hunk ./Data/IntMap.hs 1194
5742 filter :: (a -> Bool) -> IntMap a -> IntMap a
5743 filter p m
5744   = filterWithKey (\_ x -> p x) m
5745-#if __GLASGOW_HASKELL__ >= 700
5746-{-# INLINABLE filter #-}
5747-#endif
5748 
5749 -- | /O(n)/. Filter all keys\/values that satisfy some predicate.
5750 --
5751hunk ./Data/IntMap.hs 1207
5752         | p k x      = t
5753         | otherwise  = Nil
5754     go p Nil = Nil
5755-#if __GLASGOW_HASKELL__ >= 700
5756-{-# INLINABLE filterWithKey #-}
5757-#endif
5758 
5759 -- | /O(n)/. Partition the map according to some predicate. The first
5760 -- map contains all elements that satisfy the predicate, the second all
5761hunk ./Data/IntMap.hs 1219
5762 partition :: (a -> Bool) -> IntMap a -> (IntMap a,IntMap a)
5763 partition p m
5764   = partitionWithKey (\_ x -> p x) m
5765-#if __GLASGOW_HASKELL__ >= 700
5766-{-# INLINABLE partition #-}
5767-#endif
5768 
5769 -- | /O(n)/. Partition the map according to some predicate. The first
5770 -- map contains all elements that satisfy the predicate, the second all
5771hunk ./Data/IntMap.hs 1239
5772         | predicate k x -> (t,Nil)
5773         | otherwise     -> (Nil,t)
5774       Nil -> (Nil,Nil)
5775-#if __GLASGOW_HASKELL__ >= 700
5776-{-# INLINABLE partitionWithKey #-}
5777-#endif
5778 
5779 -- | /O(n)/. Map values and collect the 'Just' results.
5780 --
5781hunk ./Data/IntMap.hs 1247
5782 
5783 mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b
5784 mapMaybe f = mapMaybeWithKey (\_ x -> f x)
5785-#if __GLASGOW_HASKELL__ >= 700
5786-{-# INLINABLE mapMaybe #-}
5787-#endif
5788 
5789 -- | /O(n)/. Map keys\/values and collect the 'Just' results.
5790 --
5791hunk ./Data/IntMap.hs 1261
5792                           Just y  -> Tip k y
5793                           Nothing -> Nil
5794     go f Nil = Nil
5795-#if __GLASGOW_HASKELL__ >= 700
5796-{-# INLINABLE mapMaybeWithKey #-}
5797-#endif
5798 
5799 -- | /O(n)/. Map values and separate the 'Left' and 'Right' results.
5800 --
5801hunk ./Data/IntMap.hs 1274
5802 mapEither :: (a -> Either b c) -> IntMap a -> (IntMap b, IntMap c)
5803 mapEither f m
5804   = mapEitherWithKey (\_ x -> f x) m
5805-#if __GLASGOW_HASKELL__ >= 700
5806-{-# INLINABLE mapEither #-}
5807-#endif
5808 
5809 -- | /O(n)/. Map keys\/values and separate the 'Left' and 'Right' results.
5810 --
5811hunk ./Data/IntMap.hs 1294
5812   Left y  -> (Tip k y, Nil)
5813   Right z -> (Nil, Tip k z)
5814 mapEitherWithKey _ Nil = (Nil, Nil)
5815-#if __GLASGOW_HASKELL__ >= 700
5816-{-# INLINABLE mapEitherWithKey #-}
5817-#endif
5818 
5819 -- | /O(log n)/. The expression (@'split' k map@) is a pair @(map1,map2)@
5820 -- where all keys in @map1@ are lower than @k@ and all keys in
5821hunk ./Data/IntMap.hs 1318
5822         | k<ky      -> (Nil,t)
5823         | otherwise -> (Nil,Nil)
5824       Nil -> (Nil,Nil)
5825-#if __GLASGOW_HASKELL__ >= 700
5826-{-# INLINABLE split #-}
5827-#endif
5828 
5829 split' :: Key -> IntMap a -> (IntMap a,IntMap a)
5830 split' k t
5831hunk ./Data/IntMap.hs 1331
5832         | k<ky      -> (Nil,t)
5833         | otherwise -> (Nil,Nil)
5834       Nil -> (Nil,Nil)
5835-#if __GLASGOW_HASKELL__ >= 700
5836-{-# INLINABLE split' #-}
5837-#endif
5838 
5839 -- | /O(log n)/. Performs a 'split' but also returns whether the pivot
5840 -- key was found in the original map.
5841hunk ./Data/IntMap.hs 1354
5842         | k<ky      -> (Nil,Nothing,t)
5843         | otherwise -> (Nil,Just y,Nil)
5844       Nil -> (Nil,Nothing,Nil)
5845-#if __GLASGOW_HASKELL__ >= 700
5846-{-# INLINABLE splitLookup #-}
5847-#endif
5848 
5849 splitLookup' :: Key -> IntMap a -> (IntMap a,Maybe a,IntMap a)
5850 splitLookup' k t
5851hunk ./Data/IntMap.hs 1367
5852         | k<ky      -> (Nil,Nothing,t)
5853         | otherwise -> (Nil,Just y,Nil)
5854       Nil -> (Nil,Nothing,Nil)
5855-#if __GLASGOW_HASKELL__ >= 700
5856-{-# INLINABLE splitLookup' #-}
5857-#endif
5858 
5859 {--------------------------------------------------------------------
5860   Fold
5861hunk ./Data/IntMap.hs 1424
5862 elems :: IntMap a -> [a]
5863 elems
5864   = foldWithKey (\_ x xs -> x:xs) []
5865-#if __GLASGOW_HASKELL__ >= 700
5866-{-# INLINABLE elems #-}
5867-#endif
5868 
5869 -- | /O(n)/. Return all keys of the map in ascending order.
5870 --
5871hunk ./Data/IntMap.hs 1433
5872 keys  :: IntMap a -> [Key]
5873 keys
5874   = foldWithKey (\k _ ks -> k:ks) []
5875-#if __GLASGOW_HASKELL__ >= 700
5876-{-# INLINABLE keys  #-}
5877-#endif
5878 
5879 -- | /O(n*min(n,W))/. The set of all keys of the map.
5880 --
5881hunk ./Data/IntMap.hs 1441
5882 
5883 keysSet :: IntMap a -> IntSet.IntSet
5884 keysSet m = IntSet.fromDistinctAscList (keys m)
5885-#if __GLASGOW_HASKELL__ >= 700
5886-{-# INLINABLE keysSet #-}
5887-#endif
5888 
5889 
5890 -- | /O(n)/. Return all key\/value pairs in the map in ascending key order.
5891hunk ./Data/IntMap.hs 1451
5892 assocs :: IntMap a -> [(Key,a)]
5893 assocs m
5894   = toList m
5895-#if __GLASGOW_HASKELL__ >= 700
5896-{-# INLINABLE assocs #-}
5897-#endif
5898 
5899 
5900 {--------------------------------------------------------------------
5901hunk ./Data/IntMap.hs 1464
5902 toList :: IntMap a -> [(Key,a)]
5903 toList
5904   = foldWithKey (\k x xs -> (k,x):xs) []
5905-#if __GLASGOW_HASKELL__ >= 700
5906-{-# INLINABLE toList #-}
5907-#endif
5908 
5909 -- | /O(n)/. Convert the map to a list of key\/value pairs where the
5910 -- keys are in ascending order.
5911hunk ./Data/IntMap.hs 1474
5912 toAscList t   
5913   = -- NOTE: the following algorithm only works for big-endian trees
5914     let (pos,neg) = span (\(k,_) -> k >=0) (foldr (\k x xs -> (k,x):xs) [] t) in neg ++ pos
5915-#if __GLASGOW_HASKELL__ >= 700
5916-{-# INLINABLE toAscList #-}
5917-#endif
5918 
5919 -- | /O(n*min(n,W))/. Create a map from a list of key\/value pairs.
5920 --
5921hunk ./Data/IntMap.hs 1486
5922   = foldlStrict ins empty xs
5923   where
5924     ins t (k,x)  = insert k x t
5925-#if __GLASGOW_HASKELL__ >= 700
5926-{-# INLINABLE fromList #-}
5927-#endif
5928 
5929 -- | /O(n*min(n,W))/. Create a map from a list of key\/value pairs with a combining function. See also 'fromAscListWith'.
5930 --
5931hunk ./Data/IntMap.hs 1495
5932 fromListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a
5933 fromListWith f xs
5934   = fromListWithKey (\_ x y -> f x y) xs
5935-#if __GLASGOW_HASKELL__ >= 700
5936-{-# INLINABLE fromListWith #-}
5937-#endif
5938 
5939 -- | /O(n*min(n,W))/. Build a map from a list of key\/value pairs with a combining function. See also fromAscListWithKey'.
5940 --
5941hunk ./Data/IntMap.hs 1506
5942   = foldlStrict ins empty xs
5943   where
5944     ins t (k,x) = insertWithKey f k x t
5945-#if __GLASGOW_HASKELL__ >= 700
5946-{-# INLINABLE fromListWithKey #-}
5947-#endif
5948 
5949 -- | /O(n)/. Build a map from a list of key\/value pairs where
5950 -- the keys are in ascending order.
5951hunk ./Data/IntMap.hs 1516
5952 fromAscList :: [(Key,a)] -> IntMap a
5953 fromAscList xs
5954   = fromAscListWithKey (\_ x _ -> x) xs
5955-#if __GLASGOW_HASKELL__ >= 700
5956-{-# INLINABLE fromAscList #-}
5957-#endif
5958 
5959 -- | /O(n)/. Build a map from a list of key\/value pairs where
5960 -- the keys are in ascending order, with a combining function on equal keys.
5961hunk ./Data/IntMap.hs 1526
5962 fromAscListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a
5963 fromAscListWith f xs
5964   = fromAscListWithKey (\_ x y -> f x y) xs
5965-#if __GLASGOW_HASKELL__ >= 700
5966-{-# INLINABLE fromAscListWith #-}
5967-#endif
5968 
5969 -- | /O(n)/. Build a map from a list of key\/value pairs where
5970 -- the keys are in ascending order, with a combining function on equal keys.
5971hunk ./Data/IntMap.hs 1542
5972     combineEq z@(kz,zz) (x@(kx,xx):xs)
5973       | kx==kz    = let yy = f kx xx zz in combineEq (kx,yy) xs
5974       | otherwise = z:combineEq x xs
5975-#if __GLASGOW_HASKELL__ >= 700
5976-{-# INLINABLE fromAscListWithKey #-}
5977-#endif
5978 
5979 -- | /O(n)/. Build a map from a list of key\/value pairs where
5980 -- the keys are in ascending order and all distinct.
5981hunk ./Data/IntMap.hs 1575
5982     finish px tx (Push py ty stk) = finish p (join py ty px tx) stk
5983         where m = branchMask px py
5984               p = mask px m
5985-#if __GLASGOW_HASKELL__ >= 700
5986-{-# INLINABLE fromDistinctAscList #-}
5987-#endif
5988 
5989 data Stack a = Push {-# UNPACK #-} !Prefix !(IntMap a) !(Stack a) | Nada
5990 
5991hunk ./Data/IntMap.hs 1593
5992   = (kx == ky) && (x==y)
5993 equal Nil Nil = True
5994 equal _   _   = False
5995-#if __GLASGOW_HASKELL__ >= 700
5996-{-# INLINABLE equal #-}
5997-#endif
5998 
5999 nequal :: Eq a => IntMap a -> IntMap a -> Bool
6000 nequal (Bin p1 m1 l1 r1) (Bin p2 m2 l2 r2)
6001hunk ./Data/IntMap.hs 1601
6002   = (kx /= ky) || (x/=y)
6003 nequal Nil Nil = False
6004 nequal _   _   = True
6005-#if __GLASGOW_HASKELL__ >= 700
6006-{-# INLINABLE nequal #-}
6007-#endif
6008 
6009 {--------------------------------------------------------------------
6010   Ord
6011hunk ./Data/IntSet.hs 171
6012 -- | /O(n+m)/. See 'difference'.
6013 (\\) :: IntSet -> IntSet -> IntSet
6014 m1 \\ m2 = difference m1 m2
6015-#if __GLASGOW_HASKELL__ >= 700
6016-{-# INLINABLE (\\) #-}
6017-#endif
6018 
6019 {--------------------------------------------------------------------
6020   Types 
6021hunk ./Data/IntSet.hs 220
6022 null :: IntSet -> Bool
6023 null Nil = True
6024 null _   = False
6025-#if __GLASGOW_HASKELL__ >= 700
6026-{-# INLINABLE null #-}
6027-#endif
6028 
6029 -- | /O(n)/. Cardinality of the set.
6030 size :: IntSet -> Int
6031hunk ./Data/IntSet.hs 228
6032       Bin _ _ l r -> size l + size r
6033       Tip _ -> 1
6034       Nil   -> 0
6035-#if __GLASGOW_HASKELL__ >= 700
6036-{-# INLINABLE size #-}
6037-#endif
6038 
6039 -- | /O(min(n,W))/. Is the value a member of the set?
6040 member :: Int -> IntSet -> Bool
6041hunk ./Data/IntSet.hs 239
6042           | otherwise     = go x r
6043         go x (Tip y) = x == y
6044         go _ Nil = False
6045-#if __GLASGOW_HASKELL__ >= 700
6046-{-# INLINABLE member #-}
6047-#endif
6048 
6049 -- | /O(min(n,W))/. Is the element not in the set?
6050 notMember :: Int -> IntSet -> Bool
6051hunk ./Data/IntSet.hs 243
6052 notMember k = not . member k
6053-#if __GLASGOW_HASKELL__ >= 700
6054-{-# INLINABLE notMember #-}
6055-#endif
6056 
6057 -- 'lookup' is used by 'intersection' for left-biasing
6058 lookup :: Int -> IntSet -> Maybe Int
6059hunk ./Data/IntSet.hs 255
6060           | k == kx   = Just kx
6061           | otherwise = Nothing
6062         go _ Nil = Nothing
6063-#if __GLASGOW_HASKELL__ >= 700
6064-{-# INLINABLE lookup #-}
6065-#endif
6066 
6067 {--------------------------------------------------------------------
6068   Construction
6069hunk ./Data/IntSet.hs 288
6070           | x==y          = Tip x
6071           | otherwise     = join x (Tip x) y t
6072         go x Nil            = Tip x
6073-#if __GLASGOW_HASKELL__ >= 700
6074-{-# INLINABLE insert #-}
6075-#endif
6076 
6077 -- right-biased insertion, used by 'union'
6078 insertR :: Int -> IntSet -> IntSet
6079hunk ./Data/IntSet.hs 301
6080           | x==y          = t
6081           | otherwise     = join x (Tip x) y t
6082         go x Nil            = Tip x
6083-#if __GLASGOW_HASKELL__ >= 700
6084-{-# INLINABLE insertR #-}
6085-#endif
6086 
6087 -- | /O(min(n,W))/. Delete a value in the set. Returns the
6088 -- original set when the value was not present.
6089hunk ./Data/IntSet.hs 315
6090           | x==y          = Nil
6091           | otherwise     = t
6092         go _ t@Nil          = t
6093-#if __GLASGOW_HASKELL__ >= 700
6094-{-# INLINABLE delete #-}
6095-#endif
6096 
6097 {--------------------------------------------------------------------
6098   Union
6099hunk ./Data/IntSet.hs 323
6100 unions :: [IntSet] -> IntSet
6101 unions xs
6102   = foldlStrict union empty xs
6103-#if __GLASGOW_HASKELL__ >= 700
6104-{-# INLINABLE unions #-}
6105-#endif
6106 
6107 
6108 -- | /O(n+m)/. The union of two sets.
6109hunk ./Data/IntSet.hs 345
6110 union t (Tip x) = insertR x t  -- right bias
6111 union Nil t     = t
6112 union t Nil     = t
6113-#if __GLASGOW_HASKELL__ >= 700
6114-{-# INLINABLE union #-}
6115-#endif
6116 
6117 
6118 {--------------------------------------------------------------------
6119hunk ./Data/IntSet.hs 373
6120 difference Nil _     = Nil
6121 difference t (Tip x) = delete x t
6122 difference t Nil     = t
6123-#if __GLASGOW_HASKELL__ >= 700
6124-{-# INLINABLE difference #-}
6125-#endif
6126 
6127 
6128 
6129hunk ./Data/IntSet.hs 404
6130       Nothing -> Nil
6131 intersection Nil _ = Nil
6132 intersection _ Nil = Nil
6133-#if __GLASGOW_HASKELL__ >= 700
6134-{-# INLINABLE intersection #-}
6135-#endif
6136 
6137 
6138 
6139hunk ./Data/IntSet.hs 416
6140   = case subsetCmp t1 t2 of
6141       LT -> True
6142       _  -> False
6143-#if __GLASGOW_HASKELL__ >= 700
6144-{-# INLINABLE isProperSubsetOf #-}
6145-#endif
6146 
6147 subsetCmp :: IntSet -> IntSet -> Ordering
6148 subsetCmp t1@(Bin p1 m1 l1 r1) (Bin p2 m2 l2 r2)
6149hunk ./Data/IntSet.hs 444
6150   | otherwise  = GT  -- disjoint
6151 subsetCmp Nil Nil = EQ
6152 subsetCmp Nil _   = LT
6153-#if __GLASGOW_HASKELL__ >= 700
6154-{-# INLINABLE subsetCmp #-}
6155-#endif
6156 
6157 -- | /O(n+m)/. Is this a subset?
6158 -- @(s1 `isSubsetOf` s2)@ tells whether @s1@ is a subset of @s2@.
6159hunk ./Data/IntSet.hs 457
6160 isSubsetOf (Bin _ _ _ _) _  = False
6161 isSubsetOf (Tip x) t        = member x t
6162 isSubsetOf Nil _            = True
6163-#if __GLASGOW_HASKELL__ >= 700
6164-{-# INLINABLE isSubsetOf #-}
6165-#endif
6166 
6167 
6168 {--------------------------------------------------------------------
6169hunk ./Data/IntSet.hs 472
6170         | predicate x -> t
6171         | otherwise   -> Nil
6172       Nil -> Nil
6173-#if __GLASGOW_HASKELL__ >= 700
6174-{-# INLINABLE filter #-}
6175-#endif
6176 
6177 -- | /O(n)/. partition the set according to some predicate.
6178 partition :: (Int -> Bool) -> IntSet -> (IntSet,IntSet)
6179hunk ./Data/IntSet.hs 485
6180         | predicate x -> (t,Nil)
6181         | otherwise   -> (Nil,t)
6182       Nil -> (Nil,Nil)
6183-#if __GLASGOW_HASKELL__ >= 700
6184-{-# INLINABLE partition #-}
6185-#endif
6186 
6187 
6188 -- | /O(min(n,W))/. The expression (@'split' x set@) is a pair @(set1,set2)@
6189hunk ./Data/IntSet.hs 505
6190         | x<y         -> (Nil,t)
6191         | otherwise   -> (Nil,Nil)
6192       Nil             -> (Nil, Nil)
6193-#if __GLASGOW_HASKELL__ >= 700
6194-{-# INLINABLE split #-}
6195-#endif
6196 
6197 split' :: Int -> IntSet -> (IntSet,IntSet)
6198 split' x t
6199hunk ./Data/IntSet.hs 519
6200         | x<y       -> (Nil,t)
6201         | otherwise -> (Nil,Nil)
6202       Nil -> (Nil,Nil)
6203-#if __GLASGOW_HASKELL__ >= 700
6204-{-# INLINABLE split' #-}
6205-#endif
6206 
6207 -- | /O(min(n,W))/. Performs a 'split' but also returns whether the pivot
6208 -- element was found in the original set.
6209hunk ./Data/IntSet.hs 535
6210         | x<y       -> (Nil,False,t)
6211         | otherwise -> (Nil,True,Nil)
6212       Nil -> (Nil,False,Nil)
6213-#if __GLASGOW_HASKELL__ >= 700
6214-{-# INLINABLE splitMember #-}
6215-#endif
6216 
6217 splitMember' :: Int -> IntSet -> (IntSet,Bool,IntSet)
6218 splitMember' x t
6219hunk ./Data/IntSet.hs 549
6220         | x<y       -> (Nil,False,t)
6221         | otherwise -> (Nil,True,Nil)
6222       Nil -> (Nil,False,Nil)
6223-#if __GLASGOW_HASKELL__ >= 700
6224-{-# INLINABLE splitMember' #-}
6225-#endif
6226 
6227 {----------------------------------------------------------------------
6228   Min/Max
6229hunk ./Data/IntSet.hs 563
6230         Bin p m l r         -> let (result,t') = maxViewUnsigned r in Just (result, bin p m l t')           
6231         Tip y -> Just (y,Nil)
6232         Nil -> Nothing
6233-#if __GLASGOW_HASKELL__ >= 700
6234-{-# INLINABLE maxView #-}
6235-#endif
6236 
6237 maxViewUnsigned :: IntSet -> (Int, IntSet)
6238 maxViewUnsigned t
6239hunk ./Data/IntSet.hs 570
6240         Bin p m l r -> let (result,t') = maxViewUnsigned r in (result, bin p m l t')
6241         Tip y -> (y, Nil)
6242         Nil -> error "maxViewUnsigned Nil"
6243-#if __GLASGOW_HASKELL__ >= 700
6244-{-# INLINABLE maxViewUnsigned #-}
6245-#endif
6246 
6247 -- | /O(min(n,W))/. Retrieves the minimal key of the set, and the set
6248 -- stripped of that element, or 'Nothing' if passed an empty set.
6249hunk ./Data/IntSet.hs 580
6250         Bin p m l r         -> let (result,t') = minViewUnsigned l in Just (result, bin p m t' r)
6251         Tip y -> Just (y, Nil)
6252         Nil -> Nothing
6253-#if __GLASGOW_HASKELL__ >= 700
6254-{-# INLINABLE minView #-}
6255-#endif
6256 
6257 minViewUnsigned :: IntSet -> (Int, IntSet)
6258 minViewUnsigned t
6259hunk ./Data/IntSet.hs 587
6260         Bin p m l r -> let (result,t') = minViewUnsigned l in (result, bin p m t' r)
6261         Tip y -> (y, Nil)
6262         Nil -> error "minViewUnsigned Nil"
6263-#if __GLASGOW_HASKELL__ >= 700
6264-{-# INLINABLE minViewUnsigned #-}
6265-#endif
6266 
6267 -- | /O(min(n,W))/. Delete and find the minimal element.
6268 --
6269hunk ./Data/IntSet.hs 593
6270 -- > deleteFindMin set = (findMin set, deleteMin set)
6271 deleteFindMin :: IntSet -> (Int, IntSet)
6272 deleteFindMin = fromMaybe (error "deleteFindMin: empty set has no minimal element") . minView
6273-#if __GLASGOW_HASKELL__ >= 700
6274-{-# INLINABLE deleteFindMin #-}
6275-#endif
6276 
6277 -- | /O(min(n,W))/. Delete and find the maximal element.
6278 --
6279hunk ./Data/IntSet.hs 599
6280 -- > deleteFindMax set = (findMax set, deleteMax set)
6281 deleteFindMax :: IntSet -> (Int, IntSet)
6282 deleteFindMax = fromMaybe (error "deleteFindMax: empty set has no maximal element") . maxView
6283-#if __GLASGOW_HASKELL__ >= 700
6284-{-# INLINABLE deleteFindMax #-}
6285-#endif
6286 
6287 
6288 -- | /O(min(n,W))/. The minimal element of the set.
6289hunk ./Data/IntSet.hs 611
6290     where find (Tip x)        = x
6291           find (Bin _ _ l' _) = find l'
6292           find Nil            = error "findMin Nil"
6293-#if __GLASGOW_HASKELL__ >= 700
6294-{-# INLINABLE findMin #-}
6295-#endif
6296 
6297 -- | /O(min(n,W))/. The maximal element of a set.
6298 findMax :: IntSet -> Int
6299hunk ./Data/IntSet.hs 622
6300     where find (Tip x)        = x
6301           find (Bin _ _ _ r') = find r'
6302           find Nil            = error "findMax Nil"
6303-#if __GLASGOW_HASKELL__ >= 700
6304-{-# INLINABLE findMax #-}
6305-#endif
6306 
6307 
6308 -- | /O(min(n,W))/. Delete the minimal element.
6309hunk ./Data/IntSet.hs 627
6310 deleteMin :: IntSet -> IntSet
6311 deleteMin = maybe (error "deleteMin: empty set has no minimal element") snd . minView
6312-#if __GLASGOW_HASKELL__ >= 700
6313-{-# INLINABLE deleteMin #-}
6314-#endif
6315 
6316 -- | /O(min(n,W))/. Delete the maximal element.
6317 deleteMax :: IntSet -> IntSet
6318hunk ./Data/IntSet.hs 631
6319 deleteMax = maybe (error "deleteMax: empty set has no maximal element") snd . maxView
6320-#if __GLASGOW_HASKELL__ >= 700
6321-{-# INLINABLE deleteMax #-}
6322-#endif
6323 
6324 {----------------------------------------------------------------------
6325   Map
6326hunk ./Data/IntSet.hs 644
6327 
6328 map :: (Int->Int) -> IntSet -> IntSet
6329 map f = fromList . List.map f . toList
6330-#if __GLASGOW_HASKELL__ >= 700
6331-{-# INLINABLE map #-}
6332-#endif
6333 
6334 {--------------------------------------------------------------------
6335   Fold
6336hunk ./Data/IntSet.hs 672
6337 elems :: IntSet -> [Int]
6338 elems s
6339   = toList s
6340-#if __GLASGOW_HASKELL__ >= 700
6341-{-# INLINABLE elems #-}
6342-#endif
6343 
6344 {--------------------------------------------------------------------
6345   Lists
6346hunk ./Data/IntSet.hs 680
6347 toList :: IntSet -> [Int]
6348 toList t
6349   = fold (:) [] t
6350-#if __GLASGOW_HASKELL__ >= 700
6351-{-# INLINABLE toList #-}
6352-#endif
6353 
6354 -- | /O(n)/. Convert the set to an ascending list of elements.
6355 toAscList :: IntSet -> [Int]
6356hunk ./Data/IntSet.hs 684
6357 toAscList t = toList t
6358-#if __GLASGOW_HASKELL__ >= 700
6359-{-# INLINABLE toAscList #-}
6360-#endif
6361 
6362 -- | /O(n*min(n,W))/. Create a set from a list of integers.
6363 fromList :: [Int] -> IntSet
6364hunk ./Data/IntSet.hs 691
6365   = foldlStrict ins empty xs
6366   where
6367     ins t x  = insert x t
6368-#if __GLASGOW_HASKELL__ >= 700
6369-{-# INLINABLE fromList #-}
6370-#endif
6371 
6372 -- | /O(n)/. Build a set from an ascending list of elements.
6373 -- /The precondition (input list is ascending) is not checked./
6374hunk ./Data/IntSet.hs 702
6375     combineEq x' (x:xs)
6376       | x==x'     = combineEq x' xs
6377       | otherwise = x' : combineEq x xs
6378-#if __GLASGOW_HASKELL__ >= 700
6379-{-# INLINABLE fromAscList #-}
6380-#endif
6381 
6382 -- | /O(n)/. Build a set from an ascending list of distinct elements.
6383 -- /The precondition (input list is strictly ascending) is not checked./
6384hunk ./Data/IntSet.hs 724
6385     finish px tx (Push py ty stk) = finish p (join py ty px tx) stk
6386         where m = branchMask px py
6387               p = mask px m
6388-#if __GLASGOW_HASKELL__ >= 700
6389-{-# INLINABLE fromDistinctAscList #-}
6390-#endif
6391 
6392 data Stack = Push {-# UNPACK #-} !Prefix !IntSet !Stack | Nada
6393 
6394hunk ./Data/IntSet.hs 742
6395   = (x==y)
6396 equal Nil Nil = True
6397 equal _   _   = False
6398-#if __GLASGOW_HASKELL__ >= 700
6399-{-# INLINABLE equal #-}
6400-#endif
6401 
6402 nequal :: IntSet -> IntSet -> Bool
6403 nequal (Bin p1 m1 l1 r1) (Bin p2 m2 l2 r2)
6404hunk ./Data/IntSet.hs 750
6405   = (x/=y)
6406 nequal Nil Nil = False
6407 nequal _   _   = True
6408-#if __GLASGOW_HASKELL__ >= 700
6409-{-# INLINABLE nequal #-}
6410-#endif
6411 
6412 {--------------------------------------------------------------------
6413   Ord
6414}
6415[Make foldlStrict semantics to match foldl'.
6416Milan Straka <fox@ucw.cz>**20101022100939
6417 Ignore-this: 3790a5a47e4ff7b55c005a8c95e5890f
6418] {
6419hunk ./Data/IntMap.hs 1858
6420 --------------------------------------------------------------------}
6421 
6422 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
6423-foldlStrict = go
6424+foldlStrict f = go
6425   where
6426hunk ./Data/IntMap.hs 1860
6427-    STRICT23(go)
6428-    go f z []     = z
6429-    go f z (x:xs) = go f (f z x) xs
6430+    go z []     = z
6431+    go z (x:xs) = let z' = f z x in z' `seq` go z' xs
6432 {-# INLINE foldlStrict #-}
6433hunk ./Data/IntSet.hs 997
6434   Utilities
6435 --------------------------------------------------------------------}
6436 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
6437-foldlStrict = go
6438+foldlStrict f = go
6439   where
6440hunk ./Data/IntSet.hs 999
6441-    STRICT23(go)
6442-    go f z []     = z
6443-    go f z (x:xs) = go f (f z x) xs
6444+    go z []     = z
6445+    go z (x:xs) = let z' = f z x in z' `seq` go z' xs
6446 {-# INLINE foldlStrict #-}
6447hunk ./Data/Map.hs 2563
6448   Utilities
6449 --------------------------------------------------------------------}
6450 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
6451-foldlStrict = go
6452+foldlStrict f = go
6453   where
6454hunk ./Data/Map.hs 2565
6455-    STRICT23(go)
6456-    go f z []     = z
6457-    go f z (x:xs) = go f (f z x) xs
6458+    go z []     = z
6459+    go z (x:xs) = let z' = f z x in z' `seq` go z' xs
6460 {-# INLINE foldlStrict #-}
6461hunk ./Data/Set.hs 1064
6462   Utilities
6463 --------------------------------------------------------------------}
6464 foldlStrict :: (a -> b -> a) -> a -> [b] -> a
6465-foldlStrict = go
6466+foldlStrict f = go
6467   where
6468hunk ./Data/Set.hs 1066
6469-    STRICT23(go)
6470-    go f z []     = z
6471-    go f z (x:xs) = go f (f z x) xs
6472+    go z []     = z
6473+    go z (x:xs) = let z' = f z x in z' `seq` go z' xs
6474 {-# INLINE foldlStrict #-}
6475 
6476 {--------------------------------------------------------------------
6477}
6478[Settle performance issues in IntMap and IntSet.
6479Milan Straka <fox@ucw.cz>**20101029231653
6480 Ignore-this: c1234a5113da14178a2394976e91b786
6481 
6482 The worker-wrapper transformation is removed from
6483 all functions but lookup and member. This is the
6484 only place where it causes benefits -- a 10% to
6485 15% speedup. It increases memory allocation
6486 slightly (0-5%), but the effect on GHC is really
6487 minor.
6488 
6489 Also INLINE/INLINABLE hints are not really needed,
6490 GHC figures it all by itself. The explicit INLINE
6491 were left on internal functions that are crutial
6492 to INLINE because of performance.
6493] {
6494hunk ./Data/IntMap.hs 201
6495 import Data.Word
6496 #endif
6497 
6498--- Use macros to define strictness of functions.
6499--- STRICTxy denotes an y-ary function strict in the x-th parameter.
6500-#define STRICT12(fn) fn arg _ | arg `seq` False = undefined
6501-#define STRICT13(fn) fn arg _ _ | arg `seq` False = undefined
6502-#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
6503-#define STRICT24(fn) fn _ arg _ _ | arg `seq` False = undefined
6504-
6505 infixl 9 \\{-This comment teaches CPP correct behaviour -}
6506 
6507 -- A "Nat" is a natural machine word (an unsigned Int)
6508hunk ./Data/IntMap.hs 331
6509 notMember :: Key -> IntMap a -> Bool
6510 notMember k m = not $ member k m
6511 
6512+-- The 'go' function in the lookup causes 10% speedup, but also an increased
6513+-- memory allocation. It does not cause speedup with other methods like insert
6514+-- and delete, so it is present only in lookup.
6515+
6516 -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'.
6517 lookup :: Key -> IntMap a -> Maybe a
6518hunk ./Data/IntMap.hs 337
6519-lookup = go
6520-  where STRICT12(go)
6521-        go k (Bin _ m l r)
6522-          | zero k m  = go k l
6523-          | otherwise = go k r
6524-        go k (Tip kx x)
6525-          | k == kx   = Just x
6526-          | otherwise = Nothing
6527-        go k Nil      = Nothing
6528-#if __GLASGOW_HASKELL__ >= 700
6529-{-# INLINABLE lookup #-}
6530-#endif
6531+lookup k = k `seq` go
6532+  where
6533+    go (Bin _ m l r)
6534+      | zero k m  = go l
6535+      | otherwise = go r
6536+    go (Tip kx x)
6537+      | k == kx   = Just x
6538+      | otherwise = Nothing
6539+    go Nil      = Nothing
6540+
6541 
6542 find :: Key -> IntMap a -> a
6543 find k m
6544hunk ./Data/IntMap.hs 378
6545 empty :: IntMap a
6546 empty
6547   = Nil
6548-{-# INLINE empty #-}
6549 
6550 -- | /O(1)/. A map of one element.
6551 --
6552hunk ./Data/IntMap.hs 387
6553 singleton :: Key -> a -> IntMap a
6554 singleton k x
6555   = Tip k x
6556-{-# INLINE singleton #-}
6557 
6558 {--------------------------------------------------------------------
6559   Insert
6560hunk ./Data/IntMap.hs 401
6561 -- > insert 5 'x' empty                         == singleton 5 'x'
6562 
6563 insert :: Key -> a -> IntMap a -> IntMap a
6564-insert = go
6565-  where STRICT13(go)
6566-        go k x t@(Bin p m l r)
6567-          | nomatch k p m = join k (Tip k x) p t
6568-          | zero k m      = Bin p m (go k x l) r
6569-          | otherwise     = Bin p m l (go k x r)
6570-        go k x t@(Tip ky _)
6571-          | k==ky         = Tip k x
6572-          | otherwise     = join k (Tip k x) ky t
6573-        go k x Nil            = Tip k x
6574+insert k x t = k `seq`
6575+  case t of
6576+    Bin p m l r
6577+      | nomatch k p m -> join k (Tip k x) p t
6578+      | zero k m      -> Bin p m (insert k x l) r
6579+      | otherwise     -> Bin p m l (insert k x r)
6580+    Tip ky _
6581+      | k==ky         -> Tip k x
6582+      | otherwise     -> join k (Tip k x) ky t
6583+    Nil -> Tip k x
6584 
6585 -- right-biased insertion, used by 'union'
6586 -- | /O(min(n,W))/. Insert with a combining function.
6587hunk ./Data/IntMap.hs 439
6588 -- > insertWithKey f 5 "xxx" empty                         == singleton 5 "xxx"
6589 
6590 insertWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
6591-insertWithKey = go
6592-  where
6593-    STRICT24(go)
6594-    go f k x t@(Bin p m l r)
6595-        | nomatch k p m = join k (Tip k x) p t
6596-        | zero k m      = Bin p m (go f k x l) r
6597-        | otherwise     = Bin p m l (go f k x r)
6598-
6599-    go f k x t@(Tip ky y)
6600-        | k==ky         = Tip k (f k x y)
6601-        | otherwise     = join k (Tip k x) ky t
6602-
6603-    go _ k x Nil = Tip k x
6604+insertWithKey f k x t = k `seq`
6605+  case t of
6606+    Bin p m l r
6607+      | nomatch k p m -> join k (Tip k x) p t
6608+      | zero k m      -> Bin p m (insertWithKey f k x l) r
6609+      | otherwise     -> Bin p m l (insertWithKey f k x r)
6610+    Tip ky y
6611+      | k==ky         -> Tip k (f k x y)
6612+      | otherwise     -> join k (Tip k x) ky t
6613+    Nil -> Tip k x
6614 
6615 
6616 -- | /O(min(n,W))/. The expression (@'insertLookupWithKey' f k x map@)
6617hunk ./Data/IntMap.hs 467
6618 -- > insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing,  fromList [(3, "b"), (5, "a"), (7, "x")])
6619 
6620 insertLookupWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> (Maybe a, IntMap a)
6621-insertLookupWithKey = go
6622-  where
6623-      STRICT24(go)
6624-      go f k x t@(Bin p m l r)
6625-        | nomatch k p m = (Nothing,join k (Tip k x) p t)
6626-        | zero k m      = case go f k x l of (found, l') -> (found,Bin p m l' r)
6627-        | otherwise     = case go f k x r of (found, r') -> (found,Bin p m l r')
6628-
6629-      go f k x t@(Tip ky y)
6630-        | k==ky         = (Just y,Tip k (f k x y))
6631-        | otherwise     = (Nothing,join k (Tip k x) ky t)
6632-
6633-      go _ k x Nil = (Nothing,Tip k x)
6634+insertLookupWithKey f k x t = k `seq`
6635+  case t of
6636+    Bin p m l r
6637+      | nomatch k p m -> (Nothing,join k (Tip k x) p t)
6638+      | zero k m      -> let (found,l') = insertLookupWithKey f k x l in (found,Bin p m l' r)
6639+      | otherwise     -> let (found,r') = insertLookupWithKey f k x r in (found,Bin p m l r')
6640+    Tip ky y
6641+      | k==ky         -> (Just y,Tip k (f k x y))
6642+      | otherwise     -> (Nothing,join k (Tip k x) ky t)
6643+    Nil -> (Nothing,Tip k x)
6644 
6645 
6646 {--------------------------------------------------------------------
6647hunk ./Data/IntMap.hs 491
6648 -- > delete 5 empty                         == empty
6649 
6650 delete :: Key -> IntMap a -> IntMap a
6651-delete = go
6652-  where
6653-      STRICT12(go)
6654-      go k t@(Bin p m l r)
6655-        | nomatch k p m = t
6656-        | zero k m      = bin p m (go k l) r
6657-        | otherwise     = bin p m l (go k r)
6658-
6659-      go k t@(Tip ky _)
6660-        | k==ky         = Nil
6661-        | otherwise     = t
6662-
6663-      go _ Nil = Nil
6664-#if __GLASGOW_HASKELL__ >= 700
6665-{-# INLINABLE delete #-}
6666-#endif
6667+delete k t = k `seq`
6668+  case t of
6669+    Bin p m l r
6670+      | nomatch k p m -> t
6671+      | zero k m      -> bin p m (delete k l) r
6672+      | otherwise     -> bin p m l (delete k r)
6673+    Tip ky _
6674+      | k==ky         -> Nil
6675+      | otherwise     -> t
6676+    Nil -> Nil
6677 
6678 -- | /O(min(n,W))/. Adjust a value at a specific key. When the key is not
6679 -- a member of the map, the original map is returned.
6680hunk ./Data/IntMap.hs 548
6681 -- > updateWithKey f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
6682 
6683 updateWithKey ::  (Key -> a -> Maybe a) -> Key -> IntMap a -> IntMap a
6684-updateWithKey = go
6685-  where
6686-      STRICT23(go)
6687-      go f k t@(Bin p m l r)
6688-        | nomatch k p m = t
6689-        | zero k m      = bin p m (go f k l) r
6690-        | otherwise     = bin p m l (go f k r)
6691-
6692-      go f k t@(Tip ky y)
6693-        | k==ky         = case f k y of
6694-                             Just y' -> Tip ky y'
6695-                             Nothing -> Nil
6696-        | otherwise     = t
6697-
6698-      go _ _ Nil = Nil
6699+updateWithKey f k t = k `seq`
6700+  case t of
6701+    Bin p m l r
6702+      | nomatch k p m -> t
6703+      | zero k m      -> bin p m (updateWithKey f k l) r
6704+      | otherwise     -> bin p m l (updateWithKey f k r)
6705+    Tip ky y
6706+      | k==ky         -> case (f k y) of
6707+                           Just y' -> Tip ky y'
6708+                           Nothing -> Nil
6709+      | otherwise     -> t
6710+    Nil -> Nil
6711 
6712 -- | /O(min(n,W))/. Lookup and update.
6713 -- The function returns original value, if it is updated.
6714hunk ./Data/IntMap.hs 572
6715 -- > updateLookupWithKey f 3 (fromList [(5,"a"), (3,"b")]) == (Just "b", singleton 5 "a")
6716 
6717 updateLookupWithKey ::  (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a,IntMap a)
6718-updateLookupWithKey = go
6719-  where
6720-      STRICT23(go)
6721-      go f k t@(Bin p m l r)
6722-        | nomatch k p m = (Nothing,t)
6723-        | zero k m      = case go f k l of (found, l') -> (found,bin p m l' r)
6724-        | otherwise     = case go f k r of (found, r') -> (found,bin p m l r')
6725+updateLookupWithKey f k t = k `seq`
6726+  case t of
6727+    Bin p m l r
6728+      | nomatch k p m -> (Nothing,t)
6729+      | zero k m      -> let (found,l') = updateLookupWithKey f k l in (found,bin p m l' r)
6730+      | otherwise     -> let (found,r') = updateLookupWithKey f k r in (found,bin p m l r')
6731+    Tip ky y
6732+      | k==ky         -> case (f k y) of
6733+                           Just y' -> (Just y,Tip ky y')
6734+                           Nothing -> (Just y,Nil)
6735+      | otherwise     -> (Nothing,t)
6736+    Nil -> (Nothing,Nil)
6737 
6738hunk ./Data/IntMap.hs 585
6739-      go f k t@(Tip ky y)
6740-        | k==ky         = case f k y of
6741-                             Just y' -> (Just y,Tip ky y')
6742-                             Nothing -> (Just y,Nil)
6743-        | otherwise     = (Nothing,t)
6744 
6745hunk ./Data/IntMap.hs 586
6746-      go _ _ Nil = (Nothing,Nil)
6747 
6748 -- | /O(log n)/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof.
6749 -- 'alter' can be used to insert, delete, or update a value in an 'IntMap'.
6750hunk ./Data/IntMap.hs 591
6751 -- In short : @'lookup' k ('alter' f k m) = f ('lookup' k m)@.
6752 alter :: (Maybe a -> Maybe a) -> Int -> IntMap a -> IntMap a
6753-alter = go
6754-  where
6755-    STRICT23(go)
6756-    go f k t@(Bin p m l r)
6757-        | nomatch k p m = case f Nothing of
6758-                             Nothing -> t
6759-                             Just x  -> join k (Tip k x) p t
6760-        | zero k m      = bin p m (go f k l) r
6761-        | otherwise     = bin p m l (go f k r)
6762-
6763-    go f k t@(Tip ky y)         
6764-        | k==ky         = case f (Just y) of
6765-                             Just x -> Tip ky x
6766-                             Nothing -> Nil
6767-
6768-        | otherwise     = case f Nothing of
6769-                             Just x -> join k (Tip k x) ky t
6770-                             Nothing -> Tip ky y
6771-
6772-    go f k Nil              = case f Nothing of
6773-                             Just x -> Tip k x
6774-                             Nothing -> Nil
6775+alter f k t = k `seq`
6776+  case t of
6777+    Bin p m l r
6778+      | nomatch k p m -> case f Nothing of
6779+                           Nothing -> t
6780+                           Just x -> join k (Tip k x) p t
6781+      | zero k m      -> bin p m (alter f k l) r
6782+      | otherwise     -> bin p m l (alter f k r)
6783+    Tip ky y
6784+      | k==ky         -> case f (Just y) of
6785+                           Just x -> Tip ky x
6786+                           Nothing -> Nil
6787+      | otherwise     -> case f Nothing of
6788+                           Just x -> join k (Tip k x) ky t
6789+                           Nothing -> Tip ky y
6790+    Nil               -> case f Nothing of
6791+                           Just x -> Tip k x
6792+                           Nothing -> Nil
6793 
6794 
6795 {--------------------------------------------------------------------
6796hunk ./Data/IntMap.hs 851
6797 -- > updateMinWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
6798 
6799 updateMinWithKey :: (Key -> a -> a) -> IntMap a -> IntMap a
6800-updateMinWithKey = go
6801-  where
6802-     go f (Bin p m l r) | m < 0 = let t' = updateMinWithKeyUnsigned f r in Bin p m l t'
6803-     go f (Bin p m l r)         = let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
6804-     go f (Tip k y) = Tip k (f k y)
6805-     go f Nil       = error "maxView: empty map has no maximal element"
6806+updateMinWithKey f t
6807+    = case t of
6808+        Bin p m l r | m < 0 -> let t' = updateMinWithKeyUnsigned f r in Bin p m l t'
6809+        Bin p m l r         -> let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
6810+        Tip k y -> Tip k (f k y)
6811+        Nil -> error "maxView: empty map has no maximal element"
6812 
6813 updateMinWithKeyUnsigned :: (Key -> a -> a) -> IntMap a -> IntMap a
6814hunk ./Data/IntMap.hs 859
6815-updateMinWithKeyUnsigned = go
6816-  where
6817-     go f (Bin p m l r) = let t' = go f l in Bin p m t' r
6818-     go f (Tip k y)     = Tip k (f k y)
6819-     go f Nil           = error "updateMinWithKeyUnsigned Nil"
6820+updateMinWithKeyUnsigned f t
6821+    = case t of
6822+        Bin p m l r -> let t' = updateMinWithKeyUnsigned f l in Bin p m t' r
6823+        Tip k y -> Tip k (f k y)
6824+        Nil -> error "updateMinWithKeyUnsigned Nil"
6825 
6826 -- | /O(log n)/. Update the value at the maximal key.
6827 --
6828hunk ./Data/IntMap.hs 871
6829 -- > updateMaxWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
6830 
6831 updateMaxWithKey :: (Key -> a -> a) -> IntMap a -> IntMap a
6832-updateMaxWithKey = go
6833-  where
6834-    go f (Bin p m l r) | m < 0 = let t' = updateMaxWithKeyUnsigned f l in Bin p m t' r
6835-    go f (Bin p m l r)         = let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
6836-    go f (Tip k y)        = Tip k (f k y)
6837-    go f Nil              = error "maxView: empty map has no maximal element"
6838+updateMaxWithKey f t
6839+    = case t of
6840+        Bin p m l r | m < 0 -> let t' = updateMaxWithKeyUnsigned f l in Bin p m t' r
6841+        Bin p m l r         -> let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
6842+        Tip k y -> Tip k (f k y)
6843+        Nil -> error "maxView: empty map has no maximal element"
6844 
6845 updateMaxWithKeyUnsigned :: (Key -> a -> a) -> IntMap a -> IntMap a
6846hunk ./Data/IntMap.hs 879
6847-updateMaxWithKeyUnsigned = go
6848-  where
6849-    go f (Bin p m l r) = let t' = go f r in Bin p m l t'
6850-    go f (Tip k y)     = Tip k (f k y)
6851-    go f Nil           = error "updateMaxWithKeyUnsigned Nil"
6852+updateMaxWithKeyUnsigned f t
6853+    = case t of
6854+        Bin p m l r -> let t' = updateMaxWithKeyUnsigned f r in Bin p m l t'
6855+        Tip k y -> Tip k (f k y)
6856+        Nil -> error "updateMaxWithKeyUnsigned Nil"
6857 
6858 
6859 -- | /O(log n)/. Retrieves the maximal (key,value) pair of the map, and
6860hunk ./Data/IntMap.hs 901
6861         Nil -> Nothing
6862 
6863 maxViewUnsigned :: IntMap a -> ((Key, a), IntMap a)
6864-maxViewUnsigned t
6865+maxViewUnsigned t
6866     = case t of
6867         Bin p m l r -> let (result,t') = maxViewUnsigned r in (result,bin p m l t')
6868         Tip k y -> ((k,y), Nil)
6869hunk ./Data/IntMap.hs 922
6870         Nil -> Nothing
6871 
6872 minViewUnsigned :: IntMap a -> ((Key, a), IntMap a)
6873-minViewUnsigned t
6874+minViewUnsigned t
6875     = case t of
6876         Bin p m l r -> let (result,t') = minViewUnsigned l in (result,bin p m t' r)
6877         Tip k y -> ((k,y),Nil)
6878hunk ./Data/IntMap.hs 982
6879 findMax :: IntMap a -> (Int,a)
6880 findMax Nil = error $ "findMax: empty map has no maximal element"
6881 findMax (Tip k v) = (k,v)
6882-findMax (Bin _ m l r)
6883+findMax (Bin _ m l r)
6884   |   m < 0   = go l
6885   | otherwise = go r
6886     where go (Tip k v)      = (k,v)
6887hunk ./Data/IntMap.hs 1108
6888 -- > mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]
6889 
6890 mapWithKey :: (Key -> a -> b) -> IntMap a -> IntMap b
6891-mapWithKey = go
6892-  where
6893-   go f (Bin p m l r) = Bin p m (go f l) (go f r)
6894-   go f (Tip k x)     = Tip k (f k x)
6895-   go f Nil           = Nil
6896+mapWithKey f t 
6897+  = case t of
6898+      Bin p m l r -> Bin p m (mapWithKey f l) (mapWithKey f r)
6899+      Tip k x     -> Tip k (f k x)
6900+      Nil         -> Nil
6901 
6902 -- | /O(n)/. The function @'mapAccum'@ threads an accumulating
6903 -- argument through the map in ascending order of keys.
6904hunk ./Data/IntMap.hs 1173
6905 -- > filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
6906 
6907 filterWithKey :: (Key -> a -> Bool) -> IntMap a -> IntMap a
6908-filterWithKey = go
6909-  where
6910-    go p (Bin pr m l r) = bin pr m (go p l) (go p r)
6911-    go p t@(Tip k x)
6912-        | p k x      = t
6913-        | otherwise  = Nil
6914-    go p Nil = Nil
6915+filterWithKey predicate t
6916+  = case t of
6917+      Bin p m l r
6918+        -> bin p m (filterWithKey predicate l) (filterWithKey predicate r)
6919+      Tip k x
6920+        | predicate k x -> t
6921+        | otherwise     -> Nil
6922+      Nil -> Nil
6923 
6924 -- | /O(n)/. Partition the map according to some predicate. The first
6925 -- map contains all elements that satisfy the predicate, the second all
6926hunk ./Data/IntMap.hs 1228
6927 -- > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"
6928 
6929 mapMaybeWithKey :: (Key -> a -> Maybe b) -> IntMap a -> IntMap b
6930-mapMaybeWithKey = go
6931-  where
6932-    go f (Bin p m l r) = bin p m (go f l) (go f r)
6933-    go f (Tip k x)     = case f k x of
6934-                          Just y  -> Tip k y
6935-                          Nothing -> Nil
6936-    go f Nil = Nil
6937+mapMaybeWithKey f (Bin p m l r)
6938+  = bin p m (mapMaybeWithKey f l) (mapMaybeWithKey f r)
6939+mapMaybeWithKey f (Tip k x) = case f k x of
6940+  Just y  -> Tip k y
6941+  Nothing -> Nil
6942+mapMaybeWithKey _ Nil = Nil
6943 
6944 -- | /O(n)/. Map values and separate the 'Left' and 'Right' results.
6945 --
6946hunk ./Data/IntSet.hs 135
6947 import Data.Word
6948 #endif
6949 
6950--- Use macros to define strictness of functions.
6951--- STRICTxy denotes an y-ary function strict in the x-th parameter.
6952-#define STRICT12(fn) fn arg _ | arg `seq` False = undefined
6953-#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
6954-
6955 infixl 9 \\{-This comment teaches CPP correct behaviour -}
6956 
6957 -- A "Nat" is a natural machine word (an unsigned Int)
6958hunk ./Data/IntSet.hs 224
6959       Tip _ -> 1
6960       Nil   -> 0
6961 
6962+-- The 'go' function in the member and lookup causes 10% speedup, but also an
6963+-- increased memory allocation. It does not cause speedup with other methods
6964+-- like insert and delete, so it is present only in member and lookup.
6965+
6966 -- | /O(min(n,W))/. Is the value a member of the set?
6967 member :: Int -> IntSet -> Bool
6968hunk ./Data/IntSet.hs 230
6969-member = go
6970-  where STRICT12(go)
6971-        go x (Bin p m l r)
6972-          | nomatch x p m = False
6973-          | zero x m      = go x l
6974-          | otherwise     = go x r
6975-        go x (Tip y) = x == y
6976-        go _ Nil = False
6977+member x = x `seq` go
6978+  where
6979+    go (Bin p m l r)
6980+      | nomatch x p m = False
6981+      | zero x m      = go l
6982+      | otherwise     = go r
6983+    go (Tip y) = x == y
6984+    go Nil = False
6985 
6986 -- | /O(min(n,W))/. Is the element not in the set?
6987 notMember :: Int -> IntSet -> Bool
6988hunk ./Data/IntSet.hs 245
6989 
6990 -- 'lookup' is used by 'intersection' for left-biasing
6991 lookup :: Int -> IntSet -> Maybe Int
6992-lookup = go
6993-  where STRICT12(go)
6994-        go k (Bin _ m l r)
6995-          | zero k m  = go k l
6996-          | otherwise = go k r
6997-        go k (Tip kx)
6998-          | k == kx   = Just kx
6999-          | otherwise = Nothing
7000-        go _ Nil = Nothing
7001+lookup k = k `seq` go
7002+  where
7003+    go (Bin _ m l r)
7004+      | zero k m  = go l
7005+      | otherwise = go r
7006+    go (Tip kx)
7007+      | k == kx   = Just kx
7008+      | otherwise = Nothing
7009+    go Nil = Nothing
7010 
7011 {--------------------------------------------------------------------
7012   Construction
7013hunk ./Data/IntSet.hs 262
7014 empty :: IntSet
7015 empty
7016   = Nil
7017-{-# INLINE empty #-}
7018 
7019 -- | /O(1)/. A set of one element.
7020 singleton :: Int -> IntSet
7021hunk ./Data/IntSet.hs 267
7022 singleton x
7023   = Tip x
7024-{-# INLINE singleton #-}
7025 
7026 {--------------------------------------------------------------------
7027   Insert
7028hunk ./Data/IntSet.hs 275
7029 -- an element of the set, it is replaced by the new one, ie. 'insert'
7030 -- is left-biased.
7031 insert :: Int -> IntSet -> IntSet
7032-insert = go
7033-  where STRICT12(go)
7034-        go x t@(Bin p m l r )
7035-          | nomatch x p m = join x (Tip x) p t
7036-          | zero x m      = Bin p m (go x l) r
7037-          | otherwise     = Bin p m l (go x r)
7038-        go x t@(Tip y)
7039-          | x==y          = Tip x
7040-          | otherwise     = join x (Tip x) y t
7041-        go x Nil            = Tip x
7042+insert x t = x `seq`
7043+  case t of
7044+    Bin p m l r
7045+      | nomatch x p m -> join x (Tip x) p t
7046+      | zero x m      -> Bin p m (insert x l) r
7047+      | otherwise     -> Bin p m l (insert x r)
7048+    Tip y
7049+      | x==y          -> Tip x
7050+      | otherwise     -> join x (Tip x) y t
7051+    Nil -> Tip x
7052 
7053 -- right-biased insertion, used by 'union'
7054 insertR :: Int -> IntSet -> IntSet
7055hunk ./Data/IntSet.hs 288
7056-insertR = go
7057-  where STRICT12(go)
7058-        go x t@(Bin p m l r )
7059-          | nomatch x p m = join x (Tip x) p t
7060-          | zero x m      = Bin p m (go x l) r
7061-          | otherwise     = Bin p m l (go x r)
7062-        go x t@(Tip y)
7063-          | x==y          = t
7064-          | otherwise     = join x (Tip x) y t
7065-        go x Nil            = Tip x
7066+insertR x t = x `seq`
7067+  case t of
7068+    Bin p m l r
7069+      | nomatch x p m -> join x (Tip x) p t
7070+      | zero x m      -> Bin p m (insert x l) r
7071+      | otherwise     -> Bin p m l (insert x r)
7072+    Tip y
7073+      | x==y          -> t
7074+      | otherwise     -> join x (Tip x) y t
7075+    Nil -> Tip x
7076 
7077 -- | /O(min(n,W))/. Delete a value in the set. Returns the
7078 -- original set when the value was not present.
7079hunk ./Data/IntSet.hs 302
7080 delete :: Int -> IntSet -> IntSet
7081-delete = go
7082-  where STRICT12(go)
7083-        go x t@(Bin p m l r)
7084-          | nomatch x p m = t
7085-          | zero x m      = bin p m (go x l) r
7086-          | otherwise     = bin p m l (go x r)
7087-        go x t@(Tip y)
7088-          | x==y          = Nil
7089-          | otherwise     = t
7090-        go _ t@Nil          = t
7091+delete x t = x `seq`
7092+  case t of
7093+    Bin p m l r
7094+      | nomatch x p m -> t
7095+      | zero x m      -> bin p m (delete x l) r
7096+      | otherwise     -> bin p m l (delete x r)
7097+    Tip y
7098+      | x==y          -> Nil
7099+      | otherwise     -> t
7100+    Nil -> Nil
7101+
7102 
7103 {--------------------------------------------------------------------
7104   Union
7105}
7106[Settle performance issues in Map and Set.
7107Milan Straka <fox@ucw.cz>**20101031082146
7108 Ignore-this: 9a4c70d5f9a5884c7ff8f714ae4ff1e4
7109 
7110 Explain the INLINE/INLINABLE in the Map and Set sources.
7111 
7112 Use 'go' only for functions that can be INLINE.
7113] {
7114hunk ./Data/Map.hs 39
7115 -- the Big-O notation <http://en.wikipedia.org/wiki/Big_O_notation>.
7116 -----------------------------------------------------------------------------
7117 
7118+-- It is crucial to the performance that the functions specialize on the Ord
7119+-- type when possible. GHC 7.0 and higher does this by itself when it sees th
7120+-- unfolding of a function -- that is why all public functions are marked
7121+-- INLINABLE (that exposes the unfolding).
7122+--
7123+-- For other compilers and GHC pre 7.0, we mark some of the functions INLINE.
7124+-- We mark the functions that just navigate down the tree (lookup, insert,
7125+-- delete and similar). That navigation code gets inlined and thus specialized
7126+-- when possible. There is a price to pay -- code growth. The code INLINED is
7127+-- therefore only the tree navigation, all the real work (rebalancing) is not
7128+-- INLINED by using a NOINLINE.
7129+--
7130+-- All methods that can be INLINE are not recursive -- a 'go' function doing
7131+-- the real work is provided.
7132+
7133 module Data.Map  (
7134             -- * Map type
7135 #if !defined(TESTING)
7136hunk ./Data/Map.hs 441
7137 
7138 empty :: Map k a
7139 empty = Tip
7140-{-# INLINE empty #-}
7141 
7142 -- | /O(1)/. A map with a single element.
7143 --
7144hunk ./Data/Map.hs 449
7145 
7146 singleton :: k -> a -> Map k a
7147 singleton k x = Bin 1 k x Tip Tip
7148-{-# INLINE singleton #-}
7149 
7150 {--------------------------------------------------------------------
7151   Insertion
7152hunk ./Data/Map.hs 784
7153 -- > isJust (lookupIndex 6 (fromList [(5,"a"), (3,"b")]))   == False
7154 
7155 lookupIndex :: Ord k => k -> Map k a -> Maybe Int
7156-lookupIndex k = go k 0
7157+lookupIndex k = lkp k 0
7158   where
7159hunk ./Data/Map.hs 786
7160-    STRICT13(go)
7161-    STRICT23(go)
7162-    go k idx Tip  = Nothing
7163-    go k idx (Bin _ kx _ l r)
7164+    STRICT13(lkp)
7165+    STRICT23(lkp)
7166+    lkp k idx Tip  = Nothing
7167+    lkp k idx (Bin _ kx _ l r)
7168       = case compare k kx of
7169hunk ./Data/Map.hs 791
7170-          LT -> go k idx l
7171-          GT -> go k (idx + size l + 1) r
7172+          LT -> lkp k idx l
7173+          GT -> lkp k (idx + size l + 1) r
7174           EQ -> Just (idx + size l)
7175 #if __GLASGOW_HASKELL__ >= 700
7176 {-# INLINABLE lookupIndex #-}
7177hunk ./Data/Map.hs 832
7178 -- > updateAt (\_ _  -> Nothing)  (-1) (fromList [(5,"a"), (3,"b")])    Error: index out of range
7179 
7180 updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a
7181-updateAt = go
7182- where
7183-    STRICT23(go)
7184-    go f _ Tip  = error "Map.updateAt: index out of range"
7185-    go f i (Bin sx kx x l r) = case compare i sizeL of
7186-      LT -> balanceR kx x (go f i l) r
7187-      GT -> balanceL kx x l (go f (i-sizeL-1) r)
7188+updateAt f i t = i `seq`
7189+  case t of
7190+    Tip -> error "Map.updateAt: index out of range"
7191+    Bin sx kx x l r -> case compare i sizeL of
7192+      LT -> balanceR kx x (updateAt f i l) r
7193+      GT -> balanceL kx x l (updateAt f (i-sizeL-1) r)
7194       EQ -> case f kx x of
7195               Just x' -> Bin sx kx x' l r
7196               Nothing -> glue l r
7197hunk ./Data/Map.hs 841
7198-      where
7199+      where
7200         sizeL = size l
7201 #if __GLASGOW_HASKELL__ >= 700
7202 {-# INLINABLE updateAt #-}
7203hunk ./Data/Map.hs 949
7204 -- > updateMinWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
7205 
7206 updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
7207-updateMinWithKey = go
7208- where
7209-    go f (Bin sx kx x Tip r) = case f kx x of
7210-                                  Nothing -> r
7211-                                  Just x' -> Bin sx kx x' Tip r
7212-    go f (Bin _ kx x l r)    = balanceR kx x (go f l) r
7213-    go f Tip                 = Tip
7214+updateMinWithKey f (Bin sx kx x Tip r) = case f kx x of
7215+                                           Nothing -> r
7216+                                           Just x' -> Bin sx kx x' Tip r
7217+updateMinWithKey f (Bin _ kx x l r)    = balanceR kx x (updateMinWithKey f l) r
7218+updateMinWithKey f Tip                 = Tip
7219 #if __GLASGOW_HASKELL__ >= 700
7220 {-# INLINABLE updateMinWithKey #-}
7221 #endif
7222hunk ./Data/Map.hs 964
7223 -- > updateMaxWithKey (\ _ _ -> Nothing)                     (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
7224 
7225 updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
7226-updateMaxWithKey = go
7227- where
7228-    go f (Bin sx kx x l Tip) = case f kx x of
7229-                              Nothing -> l
7230-                              Just x' -> Bin sx kx x' l Tip
7231-    go f (Bin _ kx x l r)    = balanceL kx x l (go f r)
7232-    go f Tip                 = Tip
7233+updateMaxWithKey f (Bin sx kx x l Tip) = case f kx x of
7234+                                           Nothing -> l
7235+                                           Just x' -> Bin sx kx x' l Tip
7236+updateMaxWithKey f (Bin _ kx x l r)    = balanceL kx x l (updateMaxWithKey f r)
7237+updateMaxWithKey f Tip                 = Tip
7238 #if __GLASGOW_HASKELL__ >= 700
7239 {-# INLINABLE updateMaxWithKey #-}
7240 #endif
7241hunk ./Data/Map.hs 1400
7242 -- > filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
7243 
7244 filterWithKey :: Ord k => (k -> a -> Bool) -> Map k a -> Map k a
7245-filterWithKey = go
7246-  where
7247-    go p Tip = Tip
7248-    go p (Bin _ kx x l r)
7249-          | p kx x    = join kx x (go p l) (go p r)
7250-          | otherwise = merge (go p l) (go p r)
7251+filterWithKey p Tip = Tip
7252+filterWithKey p (Bin _ kx x l r)
7253+  | p kx x    = join kx x (filterWithKey p l) (filterWithKey p r)
7254+  | otherwise = merge (filterWithKey p l) (filterWithKey p r)
7255 #if __GLASGOW_HASKELL__ >= 700
7256 {-# INLINABLE filterWithKey #-}
7257 #endif
7258hunk ./Data/Map.hs 1460
7259 -- > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3"
7260 
7261 mapMaybeWithKey :: Ord k => (k -> a -> Maybe b) -> Map k a -> Map k b
7262-mapMaybeWithKey = go
7263-  where
7264-    go f Tip = Tip
7265-    go f (Bin _ kx x l r) = case f kx x of
7266-        Just y  -> join kx y (go f l) (go f r)
7267-        Nothing -> merge (go f l) (go f r)
7268+mapMaybeWithKey f Tip = Tip
7269+mapMaybeWithKey f (Bin _ kx x l r) = case f kx x of
7270+  Just y  -> join kx y (mapMaybeWithKey f l) (mapMaybeWithKey f r)
7271+  Nothing -> merge (mapMaybeWithKey f l) (mapMaybeWithKey f r)
7272 #if __GLASGOW_HASKELL__ >= 700
7273 {-# INLINABLE mapMaybeWithKey #-}
7274 #endif
7275hunk ./Data/Map.hs 1525
7276 -- > mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")]
7277 
7278 mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
7279-mapWithKey = go
7280-  where
7281-    go f Tip = Tip
7282-    go f (Bin sx kx x l r) = Bin sx kx (f kx x) (go f l) (go f r)
7283+mapWithKey f Tip = Tip
7284+mapWithKey f (Bin sx kx x l r) = Bin sx kx (f kx x) (mapWithKey f l) (mapWithKey f r)
7285 #if __GLASGOW_HASKELL__ >= 700
7286 {-# INLINABLE mapWithKey #-}
7287 #endif
7288hunk ./Data/Map.hs 1560
7289 -- | /O(n)/. The function 'mapAccumL' threads an accumulating
7290 -- argument throught the map in ascending order of keys.
7291 mapAccumL :: (a -> k -> b -> (a,c)) -> a -> Map k b -> (a,Map k c)
7292-mapAccumL = go
7293-  where
7294-    go f a Tip               = (a,Tip)
7295-    go f a (Bin sx kx x l r) =
7296-                 let (a1,l') = go f a l
7297-                     (a2,x') = f a1 kx x
7298-                     (a3,r') = go f a2 r
7299-                 in (a3,Bin sx kx x' l' r')
7300+mapAccumL f a Tip               = (a,Tip)
7301+mapAccumL f a (Bin sx kx x l r) =
7302+  let (a1,l') = mapAccumL f a l
7303+      (a2,x') = f a1 kx x
7304+      (a3,r') = mapAccumL f a2 r
7305+  in (a3,Bin sx kx x' l' r')
7306 #if __GLASGOW_HASKELL__ >= 700
7307 {-# INLINABLE mapAccumL #-}
7308 #endif
7309hunk ./Data/Map.hs 1573
7310 -- | /O(n)/. The function 'mapAccumR' threads an accumulating
7311 -- argument through the map in descending order of keys.
7312 mapAccumRWithKey :: (a -> k -> b -> (a,c)) -> a -> Map k b -> (a,Map k c)
7313-mapAccumRWithKey = go
7314-  where
7315-    go f a Tip = (a,Tip)
7316-    go f a (Bin sx kx x l r) =
7317-                 let (a1,r') = go f a r
7318-                     (a2,x') = f a1 kx x
7319-                     (a3,l') = go f a2 l
7320-                 in (a3,Bin sx kx x' l' r')
7321+mapAccumRWithKey f a Tip = (a,Tip)
7322+mapAccumRWithKey f a (Bin sx kx x l r) =
7323+  let (a1,r') = mapAccumRWithKey f a r
7324+      (a2,x') = f a1 kx x
7325+      (a3,l') = mapAccumRWithKey f a2 l
7326+  in (a3,Bin sx kx x' l' r')
7327 #if __GLASGOW_HASKELL__ >= 700
7328 {-# INLINABLE mapAccumRWithKey #-}
7329 #endif
7330hunk ./Data/Map.hs 2023
7331 -- > split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty)
7332 
7333 split :: Ord k => k -> Map k a -> (Map k a,Map k a)
7334-split = go
7335-  where
7336-    STRICT12(go)
7337-    go k Tip              = (Tip, Tip)
7338-    go k (Bin _ kx x l r) = case compare k kx of
7339-          LT -> let (lt,gt) = go k l in (lt,join kx x gt r)
7340-          GT -> let (lt,gt) = go k r in (join kx x l lt,gt)
7341-          EQ -> (l,r)
7342+split k t = k `seq`
7343+  case t of
7344+    Tip            -> (Tip, Tip)
7345+    Bin _ kx x l r -> case compare k kx of
7346+      LT -> let (lt,gt) = split k l in (lt,join kx x gt r)
7347+      GT -> let (lt,gt) = split k r in (join kx x l lt,gt)
7348+      EQ -> (l,r)
7349 #if __GLASGOW_HASKELL__ >= 700
7350 {-# INLINABLE split #-}
7351 #endif
7352hunk ./Data/Map.hs 2044
7353 -- > splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty)
7354 
7355 splitLookup :: Ord k => k -> Map k a -> (Map k a,Maybe a,Map k a)
7356-splitLookup = go
7357-  where
7358-    STRICT12(go)
7359-    go k Tip              = (Tip,Nothing,Tip)
7360-    go k (Bin _ kx x l r) = case compare k kx of
7361-      LT -> let (lt,z,gt) = go k l in (lt,z,join kx x gt r)
7362-      GT -> let (lt,z,gt) = go k r in (join kx x l lt,z,gt)
7363+splitLookup k t = k `seq`
7364+  case t of
7365+    Tip            -> (Tip,Nothing,Tip)
7366+    Bin _ kx x l r -> case compare k kx of
7367+      LT -> let (lt,z,gt) = splitLookup k l in (lt,z,join kx x gt r)
7368+      GT -> let (lt,z,gt) = splitLookup k r in (join kx x l lt,z,gt)
7369       EQ -> (l,Just x,r)
7370 #if __GLASGOW_HASKELL__ >= 700
7371 {-# INLINABLE splitLookup #-}
7372hunk ./Data/Map.hs 2057
7373 
7374 -- | /O(log n)/.
7375 splitLookupWithKey :: Ord k => k -> Map k a -> (Map k a,Maybe (k,a),Map k a)
7376-splitLookupWithKey = go
7377-  where
7378-    STRICT12(go)
7379-    go k Tip              = (Tip,Nothing,Tip)
7380-    go k (Bin _ kx x l r) = case compare k kx of
7381-      LT -> let (lt,z,gt) = go k l in (lt,z,join kx x gt r)
7382-      GT -> let (lt,z,gt) = go k r in (join kx x l lt,z,gt)
7383+splitLookupWithKey k t = k `seq`
7384+  case t of
7385+    Tip            -> (Tip,Nothing,Tip)
7386+    Bin _ kx x l r -> case compare k kx of
7387+      LT -> let (lt,z,gt) = splitLookupWithKey k l in (lt,z,join kx x gt r)
7388+      GT -> let (lt,z,gt) = splitLookupWithKey k r in (join kx x l lt,z,gt)
7389       EQ -> (l,Just (kx, x),r)
7390 #if __GLASGOW_HASKELL__ >= 700
7391 {-# INLINABLE splitLookupWithKey #-}
7392hunk ./Data/Set.hs 37
7393 -- equality.
7394 -----------------------------------------------------------------------------
7395 
7396+-- It is crucial to the performance that the functions specialize on the Ord
7397+-- type when possible. GHC 7.0 and higher does this by itself when it sees th
7398+-- unfolding of a function -- that is why all public functions are marked
7399+-- INLINABLE (that exposes the unfolding).
7400+--
7401+-- For other compilers and GHC pre 7.0, we mark some of the functions INLINE.
7402+-- We mark the functions that just navigate down the tree (lookup, insert,
7403+-- delete and similar). That navigation code gets inlined and thus specialized
7404+-- when possible. There is a price to pay -- code growth. The code INLINED is
7405+-- therefore only the tree navigation, all the real work (rebalancing) is not
7406+-- INLINED by using a NOINLINE.
7407+--
7408+-- All methods that can be INLINE are not recursive -- a 'go' function doing
7409+-- the real work is provided.
7410+
7411 module Data.Set  (
7412             -- * Set type
7413 #if !defined(TESTING)   
7414hunk ./Data/Set.hs 156
7415 -- Use macros to define strictness of functions.
7416 -- STRICTxy denotes an y-ary function strict in the x-th parameter.
7417 #define STRICT12(fn) fn arg _ | arg `seq` False = undefined
7418-#define STRICT23(fn) fn _ arg _ | arg `seq` False = undefined
7419 
7420 {--------------------------------------------------------------------
7421   Operators
7422hunk ./Data/Set.hs 218
7423 
7424 -- | /O(1)/. The number of elements in the set.
7425 size :: Set a -> Int
7426-size = go
7427-  where
7428-    go Tip            = 0
7429-    go (Bin sz _ _ _) = sz
7430+size Tip = 0
7431+size (Bin sz _ _ _) = sz
7432 #if __GLASGOW_HASKELL__ >= 700
7433 {-# INLINABLE size #-}
7434 #endif
7435hunk ./Data/Set.hs 234
7436           LT -> go x l
7437           GT -> go x r
7438           EQ -> True
7439+#if __GLASGOW_HASKELL__ >= 700
7440+{-# INLINABLE member #-}
7441+#else
7442 {-# INLINE member #-}
7443hunk ./Data/Set.hs 238
7444+#endif
7445 
7446 -- | /O(log n)/. Is the element not in the set?
7447 notMember :: Ord a => a -> Set a -> Bool
7448hunk ./Data/Set.hs 251
7449 -- | /O(1)/. The empty set.
7450 empty  :: Set a
7451 empty = Tip
7452-{-# INLINE empty #-}
7453 
7454 -- | /O(1)/. Create a singleton set.
7455 singleton :: a -> Set a
7456hunk ./Data/Set.hs 255
7457 singleton x = Bin 1 x Tip Tip
7458-{-# INLINE singleton #-}
7459 
7460 {--------------------------------------------------------------------
7461   Insertion, Deletion
7462hunk ./Data/Set.hs 488
7463 --------------------------------------------------------------------}
7464 -- | /O(n)/. Filter all elements that satisfy the predicate.
7465 filter :: Ord a => (a -> Bool) -> Set a -> Set a
7466-filter p = go
7467-  where
7468-    go Tip = Tip
7469-    go (Bin _ x l r)
7470-        | p x       = join x (go l) (go r)
7471-        | otherwise = merge (go l) (go r)
7472+filter p Tip = Tip
7473+filter p (Bin _ x l r)
7474+    | p x       = join x (filter p l) (filter p r)
7475+    | otherwise = merge (filter p l) (filter p r)
7476 #if __GLASGOW_HASKELL__ >= 700
7477 {-# INLINABLE filter #-}
7478 #endif
7479hunk ./Data/Set.hs 500
7480 -- the predicate and one with all elements that don't satisfy the predicate.
7481 -- See also 'split'.
7482 partition :: Ord a => (a -> Bool) -> Set a -> (Set a,Set a)
7483-partition p = go
7484-  where
7485-    go Tip = (Tip, Tip)
7486-    go (Bin _ x l r) = case (go l, go r) of
7487-        ((l1, l2), (r1, r2))
7488-            | p x       -> (join x l1 r1, merge l2 r2)
7489-            | otherwise -> (merge l1 r1, join x l2 r2)
7490+partition p Tip = (Tip, Tip)
7491+partition p (Bin _ x l r) = case (partition p l, partition p r) of
7492+  ((l1, l2), (r1, r2))
7493+    | p x       -> (join x l1 r1, merge l2 r2)
7494+    | otherwise -> (merge l1 r1, join x l2 r2)
7495 #if __GLASGOW_HASKELL__ >= 700
7496 {-# INLINABLE partition #-}
7497 #endif
7498hunk ./Data/Set.hs 536
7499 -- >     where ls = toList s
7500 
7501 mapMonotonic :: (a->b) -> Set a -> Set b
7502-mapMonotonic f = go
7503-  where
7504-    go Tip = Tip
7505-    go (Bin sz x l r) = Bin sz (f x) (go l) (go r)
7506+mapMonotonic f Tip = Tip
7507+mapMonotonic f (Bin sz x l r) = Bin sz (f x) (mapMonotonic f l) (mapMonotonic f r)
7508 #if __GLASGOW_HASKELL__ >= 700
7509 {-# INLINABLE mapMonotonic #-}
7510 #endif
7511}
7512
7513Context:
7514
7515[Fix warnings in Data.Map and Data.Set.
7516Milan Straka <fox@ucw.cz>**20100924154946
7517 Ignore-this: cb2c0a8ecf0a57acc5941ba841aa7c40
7518 
7519 Only trivial changes.
7520]
7521[Finish the started worker/wrapper transformation.
7522Milan Straka <fox@ucw.cz>**20100924153353
7523 Ignore-this: baeb24573242beb56c3bbe7ca67f5ff7
7524 
7525 Some methods (insert, lookup) were not modified as the rest
7526 (like insertWith, delete, ...). Also the `seq` were missing
7527 sometimes.
7528]
7529[Merge all the OPTIONS and LANGUAGE module pragmas.
7530Milan Straka <fox@ucw.cz>**20100924152642
7531 Ignore-this: 86067abf13f0501f29c13ec7c877533c
7532]
7533[Remove use of lambdas with irrefutable patterns
7534simonpj@microsoft.com**20100923120838
7535 Ignore-this: c36e90a0258c0d5262684c585c321419
7536]
7537[Remove most INLINE from Map, Set, IntMap and IntSet.
7538Milan Straka <fox@ucw.cz>**20100924152008
7539 Ignore-this: c88c4ede21c06bfda20af131c232a720
7540 
7541 Because of a code bloat the INLINEs cause, remove most of
7542 them. The only INLINEs left are the following:
7543 - only in Set and Map, because in IntMap and IntSet the specialization
7544   does not help
7545 - only on functions which need Ord
7546 - only on 'small' functions, namely member, notMember, lookup*,
7547   insert*, delete*, adjust*, alter*, update*
7548 
7549 All other functions of Map, Set, IntMap and IntSet are marked INLINABLE,
7550 even if they are recursive.
7551 
7552 The INLINEs left are only a short-term solution. In the long run the
7553 auto-specialization of INLINABLE methods seems a good way (maybe
7554 SPECIALIZABLE).
7555]
7556[Comment tests and benchmarks on foldlWithKey' which
7557Milan Straka <fox@ucw.cz>**20100924110705
7558 Ignore-this: 71b988389e6ae9a78ea3b0e20156ca2f
7559 was commented recently by Ian Lynagh.
7560]
7561[Worker/wrapper transformation for Data.IntSet.
7562Milan Straka <fox@ucw.cz>**20100923125604
7563 Ignore-this: b0228582818f7bfb690d0853022a7809
7564]
7565[Revert the recent contentious changes
7566Ian Lynagh <igloo@earth.li>**20100915135103
7567 Ignore-this: fe4f71ff1ade51c11421dc9974aa0fda
7568 These will probably be tidied up and reinstated later, but this gets
7569 the package back to a releasable state.
7570]
7571[Compile only the benchmark source, not the Data/*.hs.
7572Milan Straka <fox@ucw.cz>**20100921115821
7573 Ignore-this: f94d9e3ffe126cd057d23490c973a4e9
7574]
7575[Add criterion-based benchmark for IntSet.hs.
7576Milan Straka <fox@ucw.cz>**20100921103225
7577 Ignore-this: 3d31a820830c7382748626bc9a1ba54
7578 
7579 The benchmark is nearly identical copy of Set.hs benchmark.
7580]
7581[Add a testsuite for Data.IntSet.
7582Milan Straka <fox@ucw.cz>**20100921102802
7583 Ignore-this: e55484ee185e71915452bdf2a7b2a2b3
7584]
7585[Further improve Data.Set balance function.
7586Milan Straka <fox@ucw.cz>**20100921091828
7587 Ignore-this: f23be37859224e9bbe919a3c0a71fdc6
7588 
7589 As suggested by Kazu Yamamoto, we split balance to balanceL and
7590 balanceR, which handle only one-sided inbalance, but need fewer
7591 tests than balance.
7592 
7593 As nearly all functions modifying the structure use balance, this
7594 results in speedup of many functions. On my 32-bit GHC 6.12.1,
7595 11% speedup for insert, 12% speedup for delete.
7596]
7597[Further improve Data.Map balance function.
7598Milan Straka <fox@ucw.cz>**20100921091547
7599 Ignore-this: 8abfd027142a5183b2b5282e96ccb414
7600 
7601 As suggested by Kazu Yamamoto, we split balance to balanceL and
7602 balanceR, which handle only one-sided inbalance, but need fewer
7603 tests than balance.
7604 
7605 As nearly all functions modifying the structure use balance, this
7606 results in speedup of many functions. On my 32-bit GHC 6.12.1,
7607 20% speedup for insert, 7% speedup for delete, 5% speedup for update.
7608]
7609[Changing delta to 3 in Data.Set.
7610Milan Straka <fox@ucw.cz>**20100921090507
7611 Ignore-this: a47d0c542ed9cee99ad6b17c52c977a1
7612 
7613 Only possible values are 3 and 4. The value 3 has much faster inserts,
7614 value 4 slightly faster deletes, so choosing 3.
7615 
7616 Also changed the inequalities to rebalance only when one subtree
7617 is _strictly_ larger than delta * the other one, to mimic the behaviour
7618 from the proof (both from the Adams' and from the one to come).
7619]
7620[Changing delta to 3 in Data.Map.
7621Milan Straka <fox@ucw.cz>**20100921090358
7622 Ignore-this: 85f733f836b65b2b1038383ddb92e8e1
7623 
7624 Only possible values are 3 and 4. The value 3 has much faster inserts,
7625 value 4 slightly faster deletes, so choosing 3.
7626 
7627 Also changed the inequalities to rebalance only when one subtree
7628 is _strictly_ larger than delta * the other one, to mimic the behaviour
7629 from the proof (both from the Adams' and from the one to come).
7630]
7631[Correct Data.Set Arbitrary instance never to return unbalanced trees.
7632Milan Straka <fox@ucw.cz>**20100914150442
7633 Ignore-this: b5c70fa98a56f225b8eb5faf420677b0
7634 
7635 The previous instance sometimes returned unbalanced trees,
7636 which broke the tests.
7637 
7638 Also the new instance mimics Data.Map instance more closely in the shape
7639 of the generated trees.
7640]
7641[Correct Data.Map Arbitrary instance never to return unbalanced trees.
7642Milan Straka <fox@ucw.cz>**20100914145841
7643 Ignore-this: 114bbcc63acdb16b77140ea56aeb0a95
7644 
7645 The previous instance sometimes returned unbalanced trees,
7646 which broke the tests.
7647]
7648[Improve Data.Set benchmark.
7649Milan Straka <fox@ucw.cz>**20100914142010
7650 Ignore-this: 9b878ae3aa5a43ef083abfd7f9b22513
7651 
7652 Add union, difference and intersection to Data.Set benchmark.
7653]
7654[Improve benchmark infrastructure and Data.Map benchmark.
7655Milan Straka <fox@ucw.cz>**20100914141707
7656 Ignore-this: 67e8dafcb4abcb9c726b9b29c7c320fd
7657 
7658 Renamed Benchmarks.hs to Map.hs, as it only benchmarks Data.Map.
7659 Improve the Makefile to work with multiple benchmarks.
7660 Add union, difference and intersection to Data.Map benchmark.
7661]
7662[Improve the performance of Data.Set balance function.
7663Milan Straka <fox@ucw.cz>**20100914140417
7664 Ignore-this: 577c511c219695b8d483af546c7387e8
7665 
7666 The balance function is now one monolithic function, which allows
7667 to perform all pattern-matches only once.
7668 
7669 Nearly all functions modifying Data.Map use balance.
7670 The improvements are 12% for insert, 14% for delete (GHC 6.12.1).
7671]
7672[Improve the performance of Data.Map balance function.
7673Milan Straka <fox@ucw.cz>**20100914140217
7674 Ignore-this: 951181e035fcac90674dff3300350a1
7675 
7676 The balance function is now one monolithic function, which allows
7677 to perform all pattern-matches only once.
7678 
7679 Nearly all functions modifying Data.Map use balance.
7680 The improvements are 7-11% for various insert*, delete*, alter,
7681 update or intersection functions (GHC 6.12.1).
7682]
7683[Improve performance of Data.Set union and difference operations.
7684Milan Straka <fox@ucw.cz>**20100914135725
7685 Ignore-this: 6dc4a186ea060b9cdb9e783db71ca280
7686 
7687 Use datatype storing evaluated bound instead of high-order functions.
7688 The improvements are over 25% for both union and difference (GHC 6.12.1).
7689]
7690[Improve performance of Data.Map union* and difference* operations.
7691Milan Straka <fox@ucw.cz>**20100914134614
7692 Ignore-this: 35b23a40ef33e9fa14eb81fdee4b152d
7693 
7694 Use datatype storing evaluated bound instead of high-order functions.
7695 The improvements are 22% for union and 20% for difference (GHC 6.12.1).
7696]
7697[Make the Set store the elements evaluated (bang added).
7698Milan Straka <fox@ucw.cz>**20100913165132
7699 Ignore-this: b3f230db5bf30d93d3fddf2c81c5f3b4
7700]
7701[Improved performance of Data.Set
7702Johan Tibell <johan.tibell@gmail.com>**20100831124352
7703 Ignore-this: 38a304a0408d29a2956aa9a1fc0ce755
7704 
7705 Performance improvements are due to manually applying the
7706 worker/wrapper transformation and strictifying the keys.
7707 
7708 Average speed-up is 32% on a 2GHz Core 2 Duo on OS X 10.5.8
7709]
7710[Added benchmarks for Data.Set
7711Johan Tibell <johan.tibell@gmail.com>**20100831124225
7712 Ignore-this: fcacf88761034b8c534d936f0b336cc0
7713]
7714[Added a test suite for Data.Set
7715Johan Tibell <johan.tibell@gmail.com>**20100831124030
7716 Ignore-this: f430dc302c0fcb8b5d62db2272a1d6f7
7717 
7718 Expression coverage: 74%
7719]
7720[fix warnings
7721Simon Marlow <marlowsd@gmail.com>**20100831114555
7722 Ignore-this: 53df71bc054a779b8ad2dad89c09e02d
7723]
7724[Missing MagicHash for IntSet
7725Don Stewart <dons@galois.com>**20100831093446
7726 Ignore-this: d075f760adb9a2aa0ee04676e38a07cc
7727]
7728[Performance improvements for Data.IntMap (worker/wrapper and inlining)
7729Don Stewart <dons@galois.com>**20100831093316
7730 Ignore-this: 206036448558d270f0eb85ef4cd55368
7731]
7732[Add criterion-based benchmarking for IntMap
7733Don Stewart <dons@galois.com>**20100831093240
7734 Ignore-this: d7d85b9afb513532cc30f5b51a3f825e
7735]
7736[Add comprehensive testsuite for IntMap
7737Don Stewart <dons@galois.com>**20100831093202
7738 Ignore-this: d455fedbc615e5b63ac488e605550557
7739]
7740[-O2 -fregs-graph is a uniform 10% improvements for IntMap
7741Don Stewart <dons@galois.com>**20100831092956
7742 Ignore-this: 2372cf4be945fe7939d0af94e32c567f
7743]
7744[Missed base case for updateAt worker. Spotted by Jan-Willem Maessen
7745Don Stewart <dons@galois.com>**20100829163329
7746 Ignore-this: b8daf1c55c163c16f50c3b54cca2dba1
7747]
7748[Major bump (new functions, clarified strictness properties, vastly better performance)
7749Don Stewart <dons@galois.com>**20100829122628
7750 Ignore-this: 9bfbc58ecaa24a86be37b8c4cb043457
7751]
7752[Add two new functions: foldlWithKey' and insertLookupWithKey'
7753Don Stewart <dons@galois.com>**20100829122147
7754 Ignore-this: a2f112653ba38737fe1b38609e06c314
7755 
7756 These two functions use strict accumulators, compared to their existing
7757 counterparts (which are lazy left folds, that appear not to be useful).
7758 Performance is significantly better.
7759 
7760]
7761[Performance improvements to Data.Map
7762Don Stewart <dons@galois.com>**20100829120245
7763 Ignore-this: b4830cddfa6d62e4883f4e0f58ac4e57
7764 
7765 Applied several standard transformations to improve the performance of
7766 code:
7767 
7768     * Worker/wrapper of all recursive functions with constant arguments
7769     * Inlining of all (non-recursive) wrappers
7770     * Consistent use of strict keys
7771 
7772 Average performance improvements across common API (with GHC 6.12.3):
7773 
7774     * Linux / x86_64 / 2.6Ghz i7        : 48%
7775     * Mac OSX 10.5 / x86 / 2 Ghz Xeon   : 36%
7776 
7777 Graphs and raw data: http://is.gd/eJHIE
7778 
7779 This patch is (mostly) orthogonal to the algorithmic changes suggested
7780 by Milan Straka in his HW 2010 paper:
7781 
7782     http://research.microsoft.com/~simonpj/papers/containers/containers.pdf
7783 
7784 Those changes could be added separately, for some additional improvments.
7785 
7786 Work carried out over 28/29th August, 2010 in Utrecht, NL, by Johan Tibell
7787 and Don Stewart.
7788 
7789]
7790[Add a criterion-based benchmark suite for Data.Map
7791Don Stewart <dons@galois.com>**20100829114611
7792 Ignore-this: ec61668f5bcb78bd15b72e2728c01c19
7793 
7794 This adds a criterion-based micro-benchmarking suite for Data.Map. It
7795 can be used to measure performance improvements for individual top-level
7796 functions.
7797 
7798 Examples here: http://is.gd/eJHIE
7799 
7800]
7801[Add a comprehensive testsuite for Data.Map
7802Don Stewart <dons@galois.com>**20100829113545
7803 Ignore-this: 891e7fe6bac3523868714ac1ff51c0a3
7804 
7805 This patch adds a joint quickcheck2 / hunit testsuite, with coverage of
7806 91% of top level functions (remaining features are mostly in instances).
7807 
7808 The coverage data is here:
7809     
7810     http://code.haskell.org/~dons/tests/containers/hpc_index.html
7811 
7812 No bugs were found. It includes unit tests for known past bugs
7813 (balancing).
7814 
7815]
7816[Oops, get the #ifdef symbol correct.
7817Malcolm.Wallace@me.com**20100902081938]
7818[Protect a gratuitous GHC-ism with #ifdefs.
7819Malcolm.Wallace@me.com**20100902081217]
7820[Set Data.Map's delta to 4; fixes #4242
7821Ian Lynagh <igloo@earth.li>**20100815131954]
7822[Add a test for #4242
7823Ian Lynagh <igloo@earth.li>**20100815131856]
7824[Add a local type signature
7825simonpj@microsoft.com**20100730124447
7826 Ignore-this: b581d3f2c80a7a860456d589960f12f2
7827]
7828[Add type signature in local where clause
7829simonpj@microsoft.com**20100727151709
7830 Ignore-this: 5929c4156500b25b280eb414b508c508
7831]
7832[Fix Data.Sequence's breakr, and add a test for it; fixes trac #4157
7833Ian Lynagh <igloo@earth.li>**20100704140627]
7834[Fix proposal #4109: Make Data.Map.insertWith's strictness consistent
7835Ian Lynagh <igloo@earth.li>**20100615133055]
7836[Tweak layout to work with the alternative layout rule
7837Ian Lynagh <igloo@earth.li>**20091129154519]
7838[Disable building Data.Sequence (and dependents) for nhc98.
7839Malcolm.Wallace@cs.york.ac.uk**20091124025653
7840 There is some subtlety of polymorphically recursive datatypes and
7841 type-class defaulting that nhc98's type system barfs over.
7842]
7843[Fix another instance of non-ghc breakage.
7844Malcolm.Wallace@cs.york.ac.uk**20091123092637]
7845[Add #ifdef around ghc-only (<$) as member of Functor class.
7846Malcolm.Wallace@cs.york.ac.uk**20091123085155]
7847[Fix broken code in non-GHC branch of an ifdef.
7848Malcolm.Wallace@cs.york.ac.uk**20091123084824]
7849[doc bugfix: correct description of index argument
7850Ross Paterson <ross@soi.city.ac.uk>**20091028105532
7851 Ignore-this: 9790e7bf422c4cb528722c03cfa4fed9
7852 
7853 As noted by iaefai on the libraries list.
7854 
7855 Please merge to STABLE.
7856]
7857[Bump version to 0.3.0.0
7858Ian Lynagh <igloo@earth.li>**20090920141847]
7859[update base dependency
7860Ross Paterson <ross@soi.city.ac.uk>**20090916073125
7861 Ignore-this: ad382ffc6c6a18c15364e6c072f19edb
7862 
7863 The package uses mkNoRepType and Data.Functor, which were not in the
7864 stable branch of base-4.
7865]
7866[add fast version of <$ for Seq
7867Ross Paterson <ross@soi.city.ac.uk>**20090916072812
7868 Ignore-this: 5a39a7d31d39760ed589790b1118d240
7869]
7870[new methods for Data.Sequence (proposal #3271)
7871Ross Paterson <ross@soi.city.ac.uk>**20090915173324
7872 Ignore-this: cf17bedd709a6ab3448fd718dcdf62e7
7873 
7874 Adds a lot of new methods to Data.Sequence, mostly paralleling those
7875 in Data.List.  Several of these are significantly faster than versions
7876 implemented with the previous public interface.  In particular, replicate
7877 takes O(log n) time and space instead of O(n).
7878 (by Louis Wasserman)
7879]
7880[Fix "Cabal check" warnings
7881Ian Lynagh <igloo@earth.li>**20090811215900]
7882[TAG 2009-06-25
7883Ian Lynagh <igloo@earth.li>**20090625160202]
7884Patch bundle hash:
7885353f021815a427c6fa384abe9a8322b86dfefcfa