[project @ 2001-08-22 11:45:06 by sewardj]
[ghc-hetmet.git] / ghc / tests / typecheck / should_compile / tc124.hs
1 {-# OPTIONS -fglasgow-exts #-}
2
3 -- !!! Rank 2 polymorphism
4 -- Both f and g are rejected by Hugs [April 2001]
5
6 module Foo  where
7
8 data T = T { t1 :: forall a. a -> a , t2 :: forall a b. a->b->b }
9
10 -- Test pattern bindings for polymorphic fields
11 f :: T -> (Int,Char)
12 f t = let T { t1 = my_t1 } = t
13       in
14       (my_t1 3, my_t1 'c')
15
16 -- Test record update with polymorphic fields
17 g :: T -> T
18 g t = t { t2 = \x y -> y }