I don&#39;t know whether its a good name or not (the ===), but I have the following in a generic utilities file I have, and I use it every now and then.<br><br>(===) :: (Typeable a, Typeable b, Eq b) =&gt; a -&gt; b -&gt; Bool<br>
(===) x y = cast x == Just y<br><br>(Notice you don&#39;t need Eq a in the context)<br><br><div class="gmail_quote">On 11 June 2010 12:51, Ben Millwood <span dir="ltr">&lt;<a href="mailto:haskell@benmachine.co.uk">haskell@benmachine.co.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Fri, Jun 11, 2010 at 12:46 AM, Felipe Lessa &lt;<a href="mailto:felipe.lessa@gmail.com">felipe.lessa@gmail.com</a>&gt; wrote:<br>

&gt;<br>
&gt;  eqTypeable :: (Typeable a, Eq a, Typeable b, Eq b) =&gt; a -&gt; b -&gt; Bool<br>
&gt;  eqTypeable x y = case cast y of<br>
&gt;                     Just y&#39; -&gt; x == y&#39;<br>
&gt;                     Nothing -&gt; False<br>
&gt;<br>
<br>
</div>...or indeed:<br>
<br>
eqTypeable x y = cast x == Just y<br>
<div><div></div><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>