1 -- Check that "->" is an instance of Eval
5 instance (Eq b) => Eq (a -> b) where
6 (==) f g = error "attempt to compare functions"
8 -- Since Eval is a superclass of Num this fails
9 -- unless -> is an instance of Eval
10 instance (Num b) => Num (a -> b) where
11 f + g = \a -> f a + g a
12 f - g = \a -> f a - g a
13 f * g = \a -> f a * g a
14 negate f = \a -> negate (f a)
15 abs f = \a -> abs (f a)
16 signum f = \a -> signum (f a)
17 fromInteger n = \a -> fromInteger n
18 fromInt n = \a -> fromInt n