[Haskell-cafe] Array bug?

Svein Ove Aas svein.ove at aas.no
Mon Nov 3 10:47:38 EST 2008


On Sun, Nov 2, 2008 at 7:53 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> Bertram Felgenhauer wrote:
>>
>> 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.)
>
Actually, it isn't.
The code - the bounds-checking code, at least - is fairly plain haskell in
the Array package. You could take a look and, quite possibly, fix it.

> 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.
>
Sounds good to me.

> 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.
>
Go ahead. :)


More information about the Haskell-Cafe mailing list