<br><div class="gmail_quote">On Tue, Aug 28, 2012 at 12:08 PM, Nicolas Frisby <span dir="ltr">&lt;<a href="mailto:nicolas.frisby@gmail.com" target="_blank">nicolas.frisby@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Aug 28, 2012 at 3:34 AM, Simon Marlow &lt;<a href="mailto:marlowsd@gmail.com">marlowsd@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt; On 24/08/2012 07:39, Emil Axelsson wrote:<br>
&gt;&gt;&gt;&gt;&gt;<br>
</div><div class="im">&gt;&gt;&gt;&gt;&gt; Are there any dangers in comparing two StableNames of different type?<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;    stEq :: StableName a -&gt; StableName b -&gt; Bool<br>
&gt;&gt;&gt;&gt;&gt;    stEq a b = a == (unsafeCoerce b)<br>
&gt;&gt;&gt;&gt;<br>
</div><div class="im">&gt; Ok, I&#39;ve added it.  It will be in GHC 7.8.1.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;         Simon<br>
<br>
</div>Might we benefit from having a variant that returns Maybe (a :=: b)?<br>
Is that safe? I have limited experience with StableNames, but that<br>
intuitively seems safe. But polymorphism and references deserve more<br>
thought than I&#39;ve given this yet.<br>
<br>
I&#39;m referring to &quot;data (:=:) :: * -&gt; * -&gt; * where Refl :: (a :=: a)&quot;,<br>
just to be clear.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div>No.</div><div class="gmail_quote"><br></div><div class="gmail_quote">You can&#39;t safely determine that  a ~ b given that two stablenames are equal.<div>
<br></div><div>If you give Nothing a stableName, it&#39;ll have one stable name, regardless of if you use it as a Maybe Int or a Maybe Bool. Maybe Int and Maybe Bool are clearly not equal. This is admittedly an implementation detail. GHC would be perfectly within its rights (if somewhat silly) to construct a fresh Nothing every time, but it doesn&#39;t.</div>
<div><br></div><div>The reasoning you applied only works for fully monomorphic types.</div><div><br></div><div> -Edward</div></div>