@@ -71,7 +71,7 @@ main = do
71
71
, bench " insertLookupWithKey' present" $ whnf (insLookupWithKey' elems_even) m_even
72
72
, bench " mapWithKey" $ whnf (M. mapWithKey (+) ) m
73
73
, bench " foldlWithKey" $ whnf (ins elems) m
74
- , bench " foldlWithKey'" $ whnf (M. foldlWithKey' sum 0 ) m
74
+ , bench " foldlWithKey'" $ whnf (M. foldlWithKey' sumkv 0 ) m
75
75
, bench " foldrWithKey" $ whnf (M. foldrWithKey consPair [] ) m
76
76
, bench " foldrWithKey'" $ whnf (M. foldrWithKey' consPair [] ) m
77
77
, bench " update absent" $ whnf (upd Just evens) m_odd
@@ -90,13 +90,17 @@ main = do
90
90
, bench " fromList" $ whnf M. fromList elems
91
91
, bench " fromList-desc" $ whnf M. fromList elems_desc
92
92
, bench " fromAscList" $ whnf M. fromAscList elems_asc
93
- , bench " fromAscListWithKey" $ whnf (M. fromAscListWithKey (\ k v2 v1 -> k + v2 + v1)) elems_asc
93
+ , bench " fromAscListWithKey" $
94
+ whnf (M. fromAscListWithKey sumkv) elems_asc
94
95
, bench " fromDescList" $ whnf M. fromDescList elems_desc
95
- , bench " fromDescListWithKey" $ whnf (M. fromDescListWithKey (\ k v2 v1 -> k + v2 + v1)) elems_desc
96
+ , bench " fromDescListWithKey" $
97
+ whnf (M. fromDescListWithKey sumkv) elems_desc
96
98
, bench " fromDistinctAscList" $ whnf M. fromDistinctAscList elems
97
- , bench " fromDistinctAscList:fusion" $ whnf (\ n -> M. fromDistinctAscList [(i,i) | i <- [1 .. n]]) bound
99
+ , bench " fromDistinctAscList:fusion" $
100
+ whnf (\ n -> M. fromDistinctAscList [(i,i) | i <- [1 .. n]]) bound
98
101
, bench " fromDistinctDescList" $ whnf M. fromDistinctDescList elems_rev
99
- , bench " fromDistinctDescList:fusion" $ whnf (\ n -> M. fromDistinctDescList [(i,i) | i <- [n,n- 1 .. 1 ]]) bound
102
+ , bench " fromDistinctDescList:fusion" $
103
+ whnf (\ n -> M. fromDistinctDescList [(i,i) | i <- [n,n- 1 .. 1 ]]) bound
100
104
, bench " minView" $ whnf (\ m' -> case M. minViewWithKey m' of {Nothing -> 0 ; Just ((k,v),m'') -> k+ v+ M. size m''}) (M. fromAscList $ zip [1 .. 10 :: Int ] [100 .. 110 :: Int ])
101
105
, bench " eq" $ whnf (\ m' -> m' == m') m -- worst case, compares everything
102
106
, bench " compare" $ whnf (\ m' -> compare m' m') m -- worst case, compares everything
@@ -115,7 +119,7 @@ main = do
115
119
evens = [2 ,4 .. bound]
116
120
odds = [1 ,3 .. bound]
117
121
values = [1 .. bound]
118
- sum k v1 v2 = k + v1 + v2
122
+ sumkv k v1 v2 = k + v1 + v2
119
123
consPair k v xs = (k, v) : xs
120
124
121
125
add3 :: Int -> Int -> Int -> Int
0 commit comments