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.
(===) :: (Typeable a, Typeable b, Eq b) => a -> b -> Bool
(===) x y = cast x == Just y
(Notice you don't need Eq a in the context)
On Fri, Jun 11, 2010 at 12:46 AM, Felipe Lessa <felipe.lessa@gmail.com> wrote:...or indeed:
>
> eqTypeable :: (Typeable a, Eq a, Typeable b, Eq b) => a -> b -> Bool
> eqTypeable x y = case cast y of
> Just y' -> x == y'
> Nothing -> False
>
eqTypeable x y = cast x == Just y
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe