[Haskell-cafe] Re: Interesting problem from Bird (4.2.13)
Gleb Alexeyev
gleb.alexeev at gmail.com
Fri Mar 6 04:12:40 EST 2009
Gleb Alexeyev wrote:
> instance Eq a => Eq (CatList a) where
> a == b = case (viewCL a, viewCL b) of
> (Just (x, xs), Just (y, ys)) -> x==y && xs == ys
> (Nothing, Nothing) -> True
> _ -> False
I just realized that my solution is needlessly verbose, the following
instance suffices:
> instance Eq a => Eq (CatList a) where
> a == b = viewCL a == viewCL b
More information about the Haskell-Cafe
mailing list