<br><br>
<div><span class="gmail_quote">On 2/6/08, <b class="gmail_sendername">Peter Verswyvelen</b> &lt;<a href="mailto:bf3@telenet.be">bf3@telenet.be</a>&gt; 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&#39;m confused:<br><br>So monads *do* enforce uniqueness... So what is the difference between<br>
Haskell&#39;s monad approach and Clean&#39;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&#39;s approach was actually more general.</blockquote>

<div>&nbsp;</div>
<div>IO and mutable array monads could be implemented&nbsp;on top of Clean&#39;s unique arrays and world objects.&nbsp; So, I&#39;d argue that Clean is at least as general as Haskell.&nbsp;</div>
<div>&nbsp;</div>
<div>On the other hand, I&#39;ve posted two similar problems to this list. In Haskell I want to . . .</div>
<div>&nbsp;</div>
<div>1) turn a mutable array into a lazy list </div>
<div>2)&nbsp;turn the contents of a file into a lazy list</div>
<div>&nbsp;</div>
<div>The responses I&#39;ve&nbsp;received are typically:</div>
<div>&nbsp;</div>
<div>1) Use unsafeFreeze / unsafeThaw</div>
<div>2) Use hGetContents. (which uses unsafePeformIO under the hood.)</div>
<div>3) Don&#39;t use a lazy list.&nbsp; Rewrite the code to break the data up into smaller chunks and process the chunks in a loop.</div>
<div>&nbsp;</div>
<div>I have solved both of these problems in&nbsp;Clean using a lazy list without resorting to&nbsp;unsafe operations.&nbsp; So, it seems to me&nbsp;that&nbsp;uniqueness types are&nbsp;more general than monads.</div>
<div>&nbsp;</div>
<div>By the way, I&#39;m not&nbsp;good enough to&nbsp;use unsafe functions.&nbsp; My code would crash for sure.&nbsp; :-)<br>&nbsp;</div>