Haskell Platform proposal: Add the vector package

Simon Marlow marlowsd at gmail.com
Wed Jul 4 12:59:12 CEST 2012

On 18/06/2012 23:06, Roman Leshchinskiy wrote:
> On 18/06/2012, at 19:39, Johan Tibell wrote:
>> On Mon, Jun 18, 2012 at 9:54 AM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>>> I like the idea of the vector-safe package. Are you also proposing to
>>> add this package to the HP? (I would also be +1 on that)
>> I think it makes sense as a separate package, but I don't think it
>> makes sense to add to the HP. SafeHaskell isn't used enough to warrant
>> that.
> I fully agree with Johan and I wouldn't even really want to maintain
> this separate package. It is a lot of work for something I don't use
> and don't entirely understand. The *.Safe modules in vector are
> currently bitrotted since I forget to update them when I add new
> operations and I'm not really sure what is and isn't "safe" anyway.
> Is anybody interested in this code at all?

I respectfully disagree with this approach, I think it's heading in the 
wrong direction.

We should be moving towards safe APIs by default, and separating out 
unsafe APIs into separate modules.  That is what SafeHaskell is about: 
it's not an obscure feature that is only used by things like "Try 
Haskell", the boundary between safety and unsafety is something we 
should all be thinking about.  In that sense, we are all users of 
SafeHaskell.  We should think of it as "good style" and best practice to 
separate safe APIs from unsafe ones.

I would argue against adding any unsafe APIs to the Haskell Platform 
that aren't in a .Unsafe module.  (to what extent that applies to vector 
I don't know, so it may be that I'm causing trouble for the proposal here).


>>> I see that the trustworthiness of the .Safe modules is conditional on
>>> whether bound checking is enabled in vector:
>>> #if defined(VECTOR_BOUNDS_CHECKS)
>>> {-# LANGUAGE Trustworthy #-}
>>> #endif
>>> The VECTOR_BOUNDS_CHECKS pragma would not be directly available in
>>> vector-safe. But I guess, by using the install-includes cabal field,
>>> vector can export a header file that exports this symbol when bound
>>> checking is enabled.
>> That sounds like a reasonable solution.
> VECTOR_BOUNDS_CHECKS is defined in vector.cabal as follows:
>    if flag(BoundsChecks)
>      cpp-options: -DVECTOR_BOUNDS_CHECKS
> Doesn't Cabal provide access to the flags that a package has been compiled with? It seems like it should and depending on the BoundsChecks flag would be cleaner than depending on a CPP symbol.
> Roman
> _______________________________________________
> Haskell-platform mailing list
> Haskell-platform at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/haskell-platform

More information about the Libraries mailing list