[Haskell-cafe] Array bug?

Andrew Coppin andrewcoppin at btinternet.com
Sun Nov 2 13:53:24 EST 2008


Bertram Felgenhauer wrote:
> Andrew Coppin wrote:
>   
>> Bertram Felgenhauer wrote:
>>     
>>> 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.
>>>       
>> ...so it's *not* going to be fixed then?
>>     
>
> It's not going to be fixed by itself - the first comment for the
> bug report basically asks interested parties to submit a proposal
> for changing this.
>   

Well I certainly don't have the skill to fix it. (Presumably all that 
array stuff is hard-wired into the compiler.)

In my opinion, what we should have is

1. An interface that is guaranteed-safe, no matter how inefficient that is.

2. An interface that is guaranteed-efficient, no matter how unsafe that is.

3. It should be extremely easy to switch from one to the other.

You write your code against the safe interface, test it until you're 
happy with it, and then switch to the fast interface.

Currently, the "safe" interface actually allows out-of-bounds indicies 
(in a way which reveals the underlying implementation), and the "fast" 
interface isn't publicly supported. Both of these things should be changed.



More information about the Haskell-Cafe mailing list