[commit: containers] master: Fix warnings by renaming build -> create. (a7f2a4d)
Ian Lynagh
igloo at earth.li
Thu Feb 23 01:15:05 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/containers
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/a7f2a4d6c95795af4b903fde866de9cb60259030
>---------------------------------------------------------------
commit a7f2a4d6c95795af4b903fde866de9cb60259030
Author: Milan Straka <fox at ucw.cz>
Date: Fri Nov 25 10:42:12 2011 +0100
Fix warnings by renaming build -> create.
>---------------------------------------------------------------
Data/Map/Base.hs | 25 ++++++++++++-------------
Data/Map/Strict.hs | 25 ++++++++++++-------------
Data/Set.hs | 25 ++++++++++++-------------
3 files changed, 36 insertions(+), 39 deletions(-)
diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs
index cd2a110..a3c0449 100644
--- a/Data/Map/Base.hs
+++ b/Data/Map/Base.hs
@@ -1931,23 +1931,22 @@ fromAscListWithKey f xs
fromDistinctAscList :: [(k,a)] -> Map k a
fromDistinctAscList xs
- = build const (length xs) xs
+ = create const (length xs) xs
where
-- 1) use continuations so that we use heap space instead of stack space.
- -- 2) special case for n==5 to build bushier trees.
- build c 0 xs' = c Tip xs'
- build c 5 xs' = case xs' of
+ -- 2) special case for n==5 to create bushier trees.
+ create c 0 xs' = c Tip xs'
+ create c 5 xs' = case xs' of
((k1,x1):(k2,x2):(k3,x3):(k4,x4):(k5,x5):xx)
-> c (bin k4 x4 (bin k2 x2 (singleton k1 x1) (singleton k3 x3)) (singleton k5 x5)) xx
- _ -> error "fromDistinctAscList build"
- build c n xs' = seq nr $ build (buildR nr c) nl xs'
- where
- nl = n `div` 2
- nr = n - nl - 1
-
- buildR n c l ((k,x):ys) = build (buildB l k x c) n ys
- buildR _ _ _ [] = error "fromDistinctAscList buildR []"
- buildB l k x c r zs = c (bin k x l r) zs
+ _ -> error "fromDistinctAscList create"
+ create c n xs' = seq nr $ create (createR nr c) nl xs'
+ where nl = n `div` 2
+ nr = n - nl - 1
+
+ createR n c l ((k,x):ys) = create (createB l k x c) n ys
+ createR _ _ _ [] = error "fromDistinctAscList createR []"
+ createB l k x c r zs = c (bin k x l r) zs
#if __GLASGOW_HASKELL__ >= 700
{-# INLINABLE fromDistinctAscList #-}
#endif
diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs
index 4a9b1de..283a01e 100644
--- a/Data/Map/Strict.hs
+++ b/Data/Map/Strict.hs
@@ -1157,25 +1157,24 @@ fromAscListWithKey f xs
fromDistinctAscList :: [(k,a)] -> Map k a
fromDistinctAscList xs
- = build const (length xs) xs
+ = create const (length xs) xs
where
-- 1) use continuations so that we use heap space instead of stack space.
- -- 2) special case for n==5 to build bushier trees.
- build c 0 xs' = c Tip xs'
- build c 5 xs' = case xs' of
+ -- 2) special case for n==5 to create bushier trees.
+ create c 0 xs' = c Tip xs'
+ create c 5 xs' = case xs' of
((k1,x1):(k2,x2):(k3,x3):(k4,x4):(k5,x5):xx)
-> x1 `seq` x2 `seq` x3 `seq` x4 `seq` x5 `seq`
c (bin k4 x4 (bin k2 x2 (singleton k1 x1) (singleton k3 x3))
(singleton k5 x5)) xx
- _ -> error "fromDistinctAscList build"
- build c n xs' = seq nr $ build (buildR nr c) nl xs'
- where
- nl = n `div` 2
- nr = n - nl - 1
-
- buildR n c l ((k,x):ys) = x `seq` build (buildB l k x c) n ys
- buildR _ _ _ [] = error "fromDistinctAscList buildR []"
- buildB l k x c r zs = x `seq` c (bin k x l r) zs
+ _ -> error "fromDistinctAscList create"
+ create c n xs' = seq nr $ create (createR nr c) nl xs'
+ where nl = n `div` 2
+ nr = n - nl - 1
+
+ createR n c l ((k,x):ys) = x `seq` create (createB l k x c) n ys
+ createR _ _ _ [] = error "fromDistinctAscList createR []"
+ createB l k x c r zs = x `seq` c (bin k x l r) zs
#if __GLASGOW_HASKELL__ >= 700
{-# INLINABLE fromDistinctAscList #-}
#endif
diff --git a/Data/Set.hs b/Data/Set.hs
index 2ed01b3..b2fa471 100644
--- a/Data/Set.hs
+++ b/Data/Set.hs
@@ -692,23 +692,22 @@ fromAscList xs
-- /The precondition (input list is strictly ascending) is not checked./
fromDistinctAscList :: [a] -> Set a
fromDistinctAscList xs
- = build const (length xs) xs
+ = create const (length xs) xs
where
-- 1) use continutations so that we use heap space instead of stack space.
- -- 2) special case for n==5 to build bushier trees.
- build c 0 xs' = c Tip xs'
- build c 5 xs' = case xs' of
+ -- 2) special case for n==5 to create bushier trees.
+ create c 0 xs' = c Tip xs'
+ create c 5 xs' = case xs' of
(x1:x2:x3:x4:x5:xx)
-> c (bin x4 (bin x2 (singleton x1) (singleton x3)) (singleton x5)) xx
- _ -> error "fromDistinctAscList build 5"
- build c n xs' = seq nr $ build (buildR nr c) nl xs'
- where
- nl = n `div` 2
- nr = n - nl - 1
-
- buildR n c l (x:ys) = build (buildB l x c) n ys
- buildR _ _ _ [] = error "fromDistinctAscList buildR []"
- buildB l x c r zs = c (bin x l r) zs
+ _ -> error "fromDistinctAscList create 5"
+ create c n xs' = seq nr $ create (createR nr c) nl xs'
+ where nl = n `div` 2
+ nr = n - nl - 1
+
+ createR n c l (x:ys) = create (createB l x c) n ys
+ createR _ _ _ [] = error "fromDistinctAscList createR []"
+ createB l x c r zs = c (bin x l r) zs
#if __GLASGOW_HASKELL__ >= 700
{-# INLINABLE fromDistinctAscList #-}
#endif
More information about the Cvs-libraries
mailing list