Commit 98aab76a authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Be sure to UNPACK the size of an array

The code before did actually unpack the size, I think, but it
wasn't very clear, and it's better to do it explicitly
parent 31a7bb46
......@@ -381,12 +381,12 @@ instance (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5) => Ix (a1,a2,a3,a4,a5) where
-- | The type of immutable non-strict (boxed) arrays
-- with indices in @i@ and elements in @e@.
data Array i e
= Array !i -- the lower bound, l
!i -- the upper bound, u
!Int -- a cache of (rangeSize (l,u))
-- used to make sure an index is
-- really in range
(Array# e) -- The actual elements
= Array !i -- the lower bound, l
!i -- the upper bound, u
{-# UNPACK #-} !Int -- A cache of (rangeSize (l,u))
-- used to make sure an index is
-- really in range
(Array# e) -- The actual elements
-- | Mutable, boxed, non-strict arrays in the 'ST' monad. The type
-- arguments are as follows:
......@@ -398,9 +398,9 @@ data Array i e
-- * @e@: the element type of the array.
--
data STArray s i e
= STArray !i -- the lower bound, l
!i -- the upper bound, u
!Int -- a cache of (rangeSize (l,u))
= STArray !i -- the lower bound, l
!i -- the upper bound, u
{-# UNPACK #-} !Int -- A cache of (rangeSize (l,u))
-- used to make sure an index is
-- really in range
(MutableArray# s e) -- The actual elements
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment