[project @ 1999-01-23 18:10:00 by sof]
[ghc-hetmet.git] / ghc / tests / codeGen / should_run / cg011.hs
1 -- !!! simple overloading example
2
3 class Foo a where
4     foo :: a -> a -> Bool
5
6 class (Foo a) => Bar a where
7     bar :: a -> a -> Bool
8
9 instance Foo Int where
10     foo a b = a /= b
11
12 instance Foo Bool where
13     foo a b = a /= b
14
15 instance Bar Int where
16     bar a b = a < b
17
18 instance Bar Bool where
19     bar a b = a < b
20
21 foO = if bar (2::Int) (3::Int) then
22             if bar False True then
23                 (42::Int)
24             else
25                 (888::Int)
26        else
27           (999::Int)
28
29 main = print foO