From c5b24c035e56222c26a7841b6e636af0e0d96381 Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 30 Apr 2001 06:53:15 +0000 Subject: [PATCH] [project @ 2001-04-30 06:53:15 by simonpj] Add a rank-2 poly test --- ghc/tests/typecheck/should_compile/tc124.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ghc/tests/typecheck/should_compile/tc124.hs diff --git a/ghc/tests/typecheck/should_compile/tc124.hs b/ghc/tests/typecheck/should_compile/tc124.hs new file mode 100644 index 0000000..5a87eb2 --- /dev/null +++ b/ghc/tests/typecheck/should_compile/tc124.hs @@ -0,0 +1,18 @@ +{-# OPTIONS -fglasgow-exts #-} + +--!!! 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 } -- 1.7.10.4