Haskell Platform proposal: Add the vector package

Simon Marlow marlowsd at gmail.com
Mon Jul 16 13:44:21 CEST 2012


On 16/07/2012 11:01, Roman Leshchinskiy wrote:
> Thomas Schilling wrote:
>> To be fair, regardless of SH, I'd consider it good API design to put
>> unsafe things into a separate module.
>
> I'll ask again: why is putting unsafe* functions into a separate module
> preferable to just following the unsafe* naming convention? I'm honestly
> interested in an answer - it seems to me that for someone who doesn't want
> to use unsafe functions, the two approaches are essentially equivalent and
> for someone who does, a separate module is more cumbersome.

Well, for one thing you can tell whether a module has access to unsafe 
stuff by just looking at its imports.  This argument applies both to 
users (it's clearer when things are separated by module) and to the 
implementation (we don't have to maintain a per-identifier safe flag, 
which would complicate the implementation and bloat interface files).

The real problem here seems to be the clash between the meaning of 
"unsafe" in the context of Vector, and the meaning of "unsafe" in Safe 
Haskell.  I don't see a good way to resolve that conflict, though of 
course I think the definition of unsafe in Safe Haskell is sensible and 
I'd like that to become the accepted meaning of the term.  So far in 
Haskell there has been no consistent definition of unsafe, which is 
confusing for users.

Just to repeat what I said earlier, I don't see there being any 
objection to putting unsafeRead with the other unsafe functions in 
vector, even though technically it is safe.

Cheers,
	Simon



More information about the Libraries mailing list