darcs patch: Remove unsafeCoerce-importing kludgery in favor of Uns...

Ashley Yakeley ashley at semantic.org
Thu Jun 14 03:37:03 EDT 2007


John Meacham wrote:

> This is why I think an 'Unsafe.*' would be a bad idea. it would be a
> dumping ground for lots of routines with nothing in common other than it
> made someone uncomfortable at some point.

Isn't this a good idea? I want to know about this "uncomfortableness" 
especially if I can use such "uncomfortable" routines to segfault my 
program.

> I mean, think if all the
> ByteString functions dealing with pointers had to move there because you
> might pass in a bad pointer. 

They should be moved there, shouldn't they? All the unsafe stuff is in a 
single module, Data.ByteString.Base. What's the purpose of this module? 
Wouldn't that purpose be better served if it were put in Unsafe.*?

It's more helpful to me when reading a program to see the red flag 
"import Unsafe.ByteString" rather than the apparently innocuous "import 
Data.ByteString.Base"...

> We really need to stop using the terms 'safe' and 'unsafe' so much
> actually.

There seems to be a clear dividing line (with, of course, FFI stuff on 
the "unsafe" side).

But I guess it depends on your vision of the language: do you consider 
unsafePerformIO to be Haskell? At least with FFI you need to pass a flag 
to switch it on.

-- 
Ashley Yakeley



More information about the Libraries mailing list