[Haskell-cafe] Re: GATD and pattern matching
Ozgur Akgun
ozgurakgun at gmail.com
Fri Jun 11 08:52:41 EDT 2010
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 <haskell at benmachine.co.uk> wrote:
> On Fri, Jun 11, 2010 at 12:46 AM, Felipe Lessa <felipe.lessa at gmail.com>
> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100611/83f2308e/attachment.html
More information about the Haskell-Cafe
mailing list