[Haskell-cafe] Mutable arrays

Peter Verswyvelen bf3 at telenet.be
Wed Feb 6 12:45:16 EST 2008


Yeah, I also believed that, but then I'm confused:

Don Stewart wrote:
> That's a reasonable critique : its hard to enforce uniqueness, in the type
system in Haskell, -- I'd be interesting to see approaches that avoid
extending the compiler.

Neil Mitchell wrote:
> No. The monad and the primitive operations ensure it is unique, the IO
> monad is abstracted away properly, and it all works neatly so you
> can't violate the uniqueness. 

So monads *do* enforce uniqueness... So what is the difference between
Haskell's monad approach and Clean's uniqueness typing? I always thought
these were just two different ways to tackle the same problem, and I had the
feeling Haskell's approach was actually more general.

Thanks,
Peter

> -----Original Message-----
> From: Neil Mitchell [mailto:ndmitchell at gmail.com]
> Sent: Wednesday, February 06, 2008 6:25 PM
> To: Peter Verswyvelen
> Cc: Don Stewart; Jeff φ; haskell-cafe at haskell.org
> Subject: Re: [Haskell-cafe] Mutable arrays
> 
> Hi
> 
> > Isn't the compiler already "modified" in a way to deal with the
> RealWorld
> > type that is used in the IO monad? Surely the RealWorld is unique...
> 
> No. The monad and the primitive operations ensure it is unique, the IO
> monad is abstracted away properly, and it all works neatly so you
> can't violate the uniqueness. However, the realWorld thing is not
> actually unique, for example unsafeInterleaveIO and unsafePerformIO
> violate this.
> 
> Thanks
> 
> Neil
> 
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.20/1261 - Release Date:
> 2/5/2008 8:57 PM




More information about the Haskell-Cafe mailing list