[project @ 2000-12-19 10:50:51 by simonpj]
[ghc-hetmet.git] / ghc / tests / typecheck / should_run / tcrun008.hs
1 {-# OPTIONS -fglasgow-exts #-}
2
3 -- !!! Check that record selectors for polymorphic fields work right
4
5 module Main where
6
7 import IO
8
9 class Foo a where
10   bar :: a -> [a]
11
12 instance Foo Int where
13   bar x = replicate x x
14
15 instance Foo Bool where
16   bar x = [x, not x]
17
18 data Record = R {
19      blub :: Foo a => a -> [a]
20     }
21
22 main = do { let r = R {blub = bar}
23           ; print (blub r (3::Int)) 
24           ; print (blub r True)
25           }
26
27
28