Delete ghctags cabal file
[ghc.git] / testsuite / tests / typecheck / should_compile / tc088.hs
1 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2
3 -- Check that "->" is an instance of Eval
4
5 module ShouldSucceed where
6
7 instance Show (a->b) where
8 show _ = error "attempt to show function"
9
10 instance (Eq b) => Eq (a -> b) where
11 (==) f g = error "attempt to compare functions"
12
13 -- Since Eval is a superclass of Num this fails
14 -- unless -> is an instance of Eval
15 instance (Num b) => Num (a -> b) where
16 f + g = \a -> f a + g a
17 f - g = \a -> f a - g a
18 f * g = \a -> f a * g a
19 negate f = \a -> negate (f a)
20 abs f = \a -> abs (f a)
21 signum f = \a -> signum (f a)
22 fromInteger n = \a -> fromInteger n