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

Henning Thielemann lemming at henning-thielemann.de
Wed Jul 18 12:47:42 CEST 2012


On Sat, 14 Jul 2012, Henning Thielemann wrote:

> 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.

Shortly after I wrote this, I noticed that I was wrong. IO also allows you 
to crash in many ways. Thus I have to say: A Haskell 98 program without 
IO, unsafePerformIO and friends cannot crash.

I first saw the UNSAFE feature in Modula-3. Modula-3 does not have 
referential transparent functions and does not distinguish between IO 
functions and non-IO functions. So what does UNSAFE mean for Modula-3? 
Actually, Modula-3 programs with only SAFE modules cannot crash, because 
pointer arithmetic and typecasts (LOOPHOLE) are only allowed in UNSAFE 
modules.



More information about the Libraries mailing list