On Thu, Jul 11, 2013 at 10:50 AM, Brandon Allbery <allber...@gmail.com>wrote:

> > ... but functions don't have an Eq instance, and *can't* have one. > Not a general one that's interesting. There are two Eq instances that'll compile for all functions (not that it's advisable): instance Eq ((->) a b) where (==) _ _ = True instance Eq ((->) a b) where (==) _ _ = False You can't get more interesting in the general case, because you can't inspect the arguments. If you are okay with distinguishing solely by application you can get a little more interesting: instance (Bounded a, Enum a, Eq b) => Eq ((->) a b) where f == g = all (\ x -> f x == g x) [minBound .. maxBound] *Main> (&&) == (&&) True *Main> (&&) == (||) False Though I'm still not sure I'd say it's a *good idea*...

_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe