[Haskell-cafe] Why purely in haskell?

Ketil Malde ketil+haskell at ii.uib.no
Thu Jan 10 15:06:37 EST 2008


"David Roundy" <daveroundy at gmail.com> writes:

>> > I just want to point out that unsafePerformIO is at the core of the
>> > (safe) bytestring library.  As SPJ et al pointed out, this is crucial
>> > functionality, and is only unsafe if unsafely used.

>> In Modula-3 modules using hacks must be explicitly marked as UNSAFE. See
>>   http://www.cs.purdue.edu/homes/hosking/m3/reference/unsafe.html
>>  Maybe this is also an option for Haskell?

> I don't think this is a good idea.

I think the point is (should be) to mark functions unsafe when they
may be unsafe to /use/, and not when they just make use of potentially
unsafe functionality.  It is perfectly reasonable to write safe (pure)
code that uses unsafe ones.  You just have to trust the author to get
it right.

> I'd be curious as to how much of the Prelude would be marked unsafe
> if you had your wish...

All of it?  In the end it is all passed to GCC (or generates
assembly), which is inherently "unsafe". :-)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list