I don'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) => a -> b -> Bool<br>
(===) x y = cast x == Just y<br><br>(Notice you don't need Eq a in the context)<br><br><div class="gmail_quote">On 11 June 2010 12:51, Ben Millwood <span dir="ltr"><<a href="mailto:haskell@benmachine.co.uk">haskell@benmachine.co.uk</a>></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 <<a href="mailto:felipe.lessa@gmail.com">felipe.lessa@gmail.com</a>> wrote:<br>
><br>
> eqTypeable :: (Typeable a, Eq a, Typeable b, Eq b) => a -> b -> Bool<br>
> eqTypeable x y = case cast y of<br>
> Just y' -> x == y'<br>
> Nothing -> False<br>
><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>