
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 11 June 2010 12:51, Ben Millwood
On Fri, Jun 11, 2010 at 12:46 AM, Felipe Lessa
wrote: 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
...or indeed:
eqTypeable x y = cast x == Just y _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ozgur Akgun