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