[project @ 2001-04-30 06:53:15 by simonpj]
authorsimonpj <unknown>
Mon, 30 Apr 2001 06:53:15 +0000 (06:53 +0000)
committersimonpj <unknown>
Mon, 30 Apr 2001 06:53:15 +0000 (06:53 +0000)
Add a rank-2 poly test

ghc/tests/typecheck/should_compile/tc124.hs [new file with mode: 0644]

diff --git a/ghc/tests/typecheck/should_compile/tc124.hs b/ghc/tests/typecheck/should_compile/tc124.hs
new file mode 100644 (file)
index 0000000..5a87eb2
--- /dev/null
@@ -0,0 +1,18 @@
+{-# OPTIONS -fglasgow-exts #-}\r
+\r
+--!!! Rank 2 polymorphism\r
+-- Both f and g are rejected by Hugs [April 2001]\r
+\r
+module Foo  where\r
+\r
+data T = T { t1 :: forall a. a -> a , t2 :: forall a b. a->b->b }\r
+\r
+-- Test pattern bindings for polymorphic fields\r
+f :: T -> (Int,Char)\r
+f t = let T { t1 = my_t1 } = t\r
+      in\r
+      (my_t1 3, my_t1 'c')\r
+\r
+-- Test record update with polymorphic fields\r
+g :: T -> T\r
+g t = t { t2 = \x y -> y }\r