safe vs. unsafe (Was: Haskell Platform proposal: Add the vector package)

Henning Thielemann lemming at
Sat Jul 14 09:16:04 CEST 2012

On Fri, 13 Jul 2012, Brandon Allbery wrote:

> And now I'm having a "so what's the point?" moment?  All this effort so we can just mark random stuff as
> Trusted anyway?

Today we have 'unsafePerformIO'. So if we praise the merits of Haskell's 
strong type system and then mention 'unsafePerformIO' the audience will 
ask "so what's the point of type safety then?" Well, the point is that 
unsafePerformIO is strongly discouraged and every use of it should be 
considered carefully.
  I actually check packages that I install for the use of unsafePerformIO. 
For this reason I rejected to use for instance the cmdargs package because 
in my opinion unsafePerformIO is not necessary for implementing a command 
line argument parser. I have learnt that a safer interface was added since 
then, but the unsafe one still exists. SafeHaskell could help to make 
explicit what parts of the package are "clean" and which ones are "hacks".

So I think SafeHaskell could be a way to locate problems in code faster. 
Since a Haskell 98 program without unsafePerformIO and friends cannot 
crash, a crash can be only caused by Unsafe code.

More information about the Libraries mailing list