[commit: packages/array] master: Don't needlessly call bounds in Data.Array.Base.elems (#10014) (297f9a5)

git at git.haskell.org git at git.haskell.org
Wed Oct 21 20:48:56 UTC 2015


Repository : ssh://git@git.haskell.org/array

On branch  : master
Link       : http://git.haskell.org/packages/array.git/commitdiff/297f9a5367868df9c03d53e461a7a6cfb9d328d5

>---------------------------------------------------------------

commit 297f9a5367868df9c03d53e461a7a6cfb9d328d5
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Wed Oct 21 22:45:12 2015 +0200

    Don't needlessly call bounds in Data.Array.Base.elems (#10014)


>---------------------------------------------------------------

297f9a5367868df9c03d53e461a7a6cfb9d328d5
 Data/Array/Base.hs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs
index ab41c0b..9908ad2 100644
--- a/Data/Array/Base.hs
+++ b/Data/Array/Base.hs
@@ -278,8 +278,7 @@ indices arr = case bounds arr of (l,u) -> range (l,u)
 -- | Returns a list of all the elements of an array, in the same order
 -- as their indices.
 elems :: (IArray a e, Ix i) => a i e -> [e]
-elems arr = case bounds arr of
-    (_l, _u) -> [unsafeAt arr i | i <- [0 .. numElements arr - 1]]
+elems arr = [unsafeAt arr i | i <- [0 .. numElements arr - 1]]
 
 {-# INLINE assocs #-}
 -- | Returns the contents of an array as a list of associations.



More information about the ghc-commits mailing list