[Haskell-beginners] (Implicit) equality testing using multiple function definitions

Tom Murphy amindfv at gmail.com
Tue Jul 19 02:44:18 CEST 2011


Hi list!
     When I define an algebraic datatype without an instance for Eq,
I'm obviously unable to use the (==) function on it. I can
pattern-match with a series of function definitions (f [] = False; f x
= True) on the expression, though. Why is that?
     I understand that in the second case I'm not literally using the
(==) function, but it seems like there would be instances where you'd
intentionally not want to be able to test for equality, and
pattern-matching with multiple function definitions circumvents that.

Thanks for your time,
Tom



More information about the Beginners mailing list