<br><br>
<div><span class="gmail_quote">On 2/6/08, <b class="gmail_sendername">Peter Verswyvelen</b> <<a href="mailto:bf3@telenet.be">bf3@telenet.be</a>> wrote:</span></div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Yeah, I also believed that, but then I'm confused:<br><br>So monads *do* enforce uniqueness... So what is the difference between<br>
Haskell's monad approach and Clean's uniqueness typing? I always thought<br>these were just two different ways to tackle the same problem, and I had the<br>feeling Haskell's approach was actually more general.</blockquote>
<div> </div>
<div>IO and mutable array monads could be implemented on top of Clean's unique arrays and world objects. So, I'd argue that Clean is at least as general as Haskell. </div>
<div> </div>
<div>On the other hand, I've posted two similar problems to this list. In Haskell I want to . . .</div>
<div> </div>
<div>1) turn a mutable array into a lazy list </div>
<div>2) turn the contents of a file into a lazy list</div>
<div> </div>
<div>The responses I've received are typically:</div>
<div> </div>
<div>1) Use unsafeFreeze / unsafeThaw</div>
<div>2) Use hGetContents. (which uses unsafePeformIO under the hood.)</div>
<div>3) Don't use a lazy list. Rewrite the code to break the data up into smaller chunks and process the chunks in a loop.</div>
<div> </div>
<div>I have solved both of these problems in Clean using a lazy list without resorting to unsafe operations. So, it seems to me that uniqueness types are more general than monads.</div>
<div> </div>
<div>By the way, I'm not good enough to use unsafe functions. My code would crash for sure. :-)<br> </div>