Possible Duplicate:
Comparing functions in Haskell
I'm learning haskell, wanted to know is something like this possible? All I want is to compare if parameter 'function' is equal to one of the functions a or b. How to do this?
Example code:
a,b :: Integer -> Integer
a x = x+1
b x = x-1
c function parameter = if function == a
then ... parameter -- Do a related stuff
else ... parameter -- Do b related stuff
(==)the parameters have to be part of theEqtypeclass, and I don't think functions can be part of typeclasses.There is not, and will never be, a way to compare two functions for equality. There is a mathematical proof that it is not possible in general.