unsafeness of unsafeInterleaveIO

Remi Turk rturk at science.uva.nl
Fri Jun 10 14:16:10 EDT 2005

On Fri, Jun 10, 2005 at 07:32:42PM +0200, Lennart Augustsson wrote:
> Andre Pang wrote:
> >G'day all,
> >
> >Just looking at the documentation for System.IO.unsafeInterleaveIO,  
> >what exactly is unsafe about it?
> You pick. :)
> It can break referential transparency.  It can break type safety.
> 	-- Lennart

Are you sure you're not talking about unsafePerformIO?

System.IO.Unsafe.unsafePerformIO    :: IO a -> a
System.IO.Unsafe.unsafeInterleaveIO :: IO a -> IO a

As far as I know unsafeInterleaveIO in general isn't any unsafer
than it's "special cases" getContents / hGetContents / readFile /
getChanContents.  Although fighting lazy IO might occasionally
drive someone mad, which could arguably be called "unsafe".


Nobody can be exactly like me. Even I have trouble doing it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/glasgow-haskell-users/attachments/20050610/8e565c29/attachment-0001.bin

More information about the Glasgow-haskell-users mailing list