#1610: Make arrays safer
--------------------------------+-------------------------------------------
Reporter: igloo | Owner:
Type: proposal | Status: new
Priority: high | Milestone: 6.8
Component: libraries (other) | Version: 6.6.1
Severity: normal | Keywords:
Difficulty: Unknown | Os: Unknown
Testcase: | Architecture: Unknown
--------------------------------+-------------------------------------------
This is a proposal to make arrays safer (e.g. see #1046).
This is a divergence from Haskell 98.
The patches:
* Add (numElements :: Ix i => a i e -> Int) to IArray class
* Array types get an extra field for numElements, e.g.
{{{
-data UArray i e = UArray !i !i ByteArray#
+data UArray i e = UArray !i !i !Int ByteArray#
}}}
This is a cache of rangeSize(l,u)
* Add safeRangeSize (always returns >= 0)
* Add safeIndex (use unsafeIndex (no Ix inRange check), but check index <
numElements)
* unsafeForeignPtrToStorableArray gained an (Ix i) context
* Use the new functions in various places
Suggested deadline: 24 Aug 2007.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1610>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs