Commit c5b24c03 authored by simonpj's avatar simonpj
Browse files

[project @ 2001-04-30 06:53:15 by simonpj]

Add a rank-2 poly test
parent b87e1a7a
{-# 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 }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment