Haskell Platform proposal: Add the vector package

Roman Leshchinskiy rl at cse.unsw.edu.au
Mon Jul 16 12:05:56 CEST 2012


Gábor Lehel wrote:
> On Wed, Jul 4, 2012 at 5:33 PM, Roman Leshchinskiy <rl at cse.unsw.edu.au>
> wrote:
>> [...] It still uses
>> "unsafe" to distinguish between functions that do bounds checking and
>> those that don't. What would be the benefit of moving functions like
>> unsafeIndex into a separate module (and would it be called
>> Unsafe.unsafeIndex then? or would it be Unsafe.index?)? [...]
>
> Just to pick out this small tidbit, FWIW the Vector.index and
> Vector.Unsafe.index scheme has the advantage that you could simply
> swap out a module import to switch between bounds-checked and
> unchecked implementations.

Alas, that wouldn't really work because you would still have to import the
safe module for functions like map. I've wanted to add *.Unchecked modules
which would export exactly the same interface as the normal ones but
without bounds checking. However, it just never seemed to be worth the
extra work.

Roman






More information about the Libraries mailing list