On Thu, Jun 9, 2011 at 6:04 PM, Felipe Almeida Lessa <span dir="ltr">&lt;<a href="mailto:felipe.lessa@gmail.com">felipe.lessa@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Something like this?<br>
<br>
  equivalenceClosure = fix $ \f e -&gt;<br>
    let e&#39; = reflexivity . symmetry . transitivity $ e<br>
    in if e&#39; == e then e else f e&#39;<br>
<br>
Cheers,<br>
<br>
--<br>
<font color="#888888">Felipe.<br>
</font></blockquote></div><br><div><div>I managed something even &quot;clearer&quot;.  I still have very little intuition about what&#39;s going on, but I had an aha moment -- which I promptly forgot :0( -- and at least there&#39;s a mechanical translation from the iterate version to the fix one.</div>
<div><br></div><div>equivalenceClosure :: (Ord a) =&gt; Relation a -&gt; Relation a</div><div>equivalenceClosure = fix (\f -&gt; reflexivity . symmetry . transitivity)</div></div>