[Haskell-cafe] Array bug?

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sat Nov 1 10:14:30 EDT 2008


Andrew Coppin wrote:
> Consider the following GHCi session:
>
> GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
> Prelude Data.Array.IO> t <- newArray ((0,0),(5,4)) 0 :: IO (IOUArray (Int,Int) Int)
> Prelude Data.Array.IO> getBounds t
> ((0,0),(5,4))
> Prelude Data.Array.IO>
>
> Is this a known bug? Is it likely to be fixed any time soon? (I'm guessing 
> the bug is as simple is converting indicies to integers and then checking 
> the integers are in-range, rather than the underlying index type.)

Yes, it's a known bug - a conscious choice really. See

    http://hackage.haskell.org/trac/ghc/ticket/2120

It's somewhat ironic that this behaviour was introduced by a patch
that made arrays safer to use in other respects.

Bertram


More information about the Haskell-Cafe mailing list