blob: 05faeae482f48fcebc6193b4cff01ffbb1bd9e0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-- Check that "->" is an instance of Eval
module ShouldSucceed where
instance Show (a->b)
instance (Eq b) => Eq (a -> b) where
(==) f g = error "attempt to compare functions"
-- Since Eval is a superclass of Num this fails
-- unless -> is an instance of Eval
instance (Num b) => Num (a -> b) where
f + g = \a -> f a + g a
f - g = \a -> f a - g a
f * g = \a -> f a * g a
negate f = \a -> negate (f a)
abs f = \a -> abs (f a)
signum f = \a -> signum (f a)
fromInteger n = \a -> fromInteger n
|