diff options
Diffstat (limited to 'testsuite/tests/typecheck/should_run/tcrun008.hs')
-rw-r--r-- | testsuite/tests/typecheck/should_run/tcrun008.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_run/tcrun008.hs b/testsuite/tests/typecheck/should_run/tcrun008.hs new file mode 100644 index 0000000000..80097a8f24 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun008.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE Rank2Types #-} + +-- !!! Check that record selectors for polymorphic fields work right + +module Main where + +class Foo a where + bar :: a -> [a] + +instance Foo Int where + bar x = replicate x x + +instance Foo Bool where + bar x = [x, not x] + +data Record = R { + blub :: Foo a => a -> [a] + } + +main = do { let r = R {blub = bar} + ; print (blub r (3::Int)) + ; print (blub r True) + } + + + |