summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc124.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/tc124.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/tc124.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/tc124.hs b/testsuite/tests/typecheck/should_compile/tc124.hs
new file mode 100644
index 0000000000..cd2362be4f
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/tc124.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE Rank2Types #-}
+
+-- !!! Rank 2 polymorphism
+-- Both f and g are rejected by Hugs [April 2001]
+
+module Foo where
+
+data T = T { t1 :: forall a. a -> a , t2 :: forall a b. a->b->b }
+
+-- Test pattern bindings for polymorphic fields
+f :: T -> (Int,Char)
+f t = let T { t1 = my_t1 } = t
+ in
+ (my_t1 3, my_t1 'c')
+
+-- Test record update with polymorphic fields
+g :: T -> T
+g t = t { t2 = \x y -> y }