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