summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_run/tcrun008.hs
blob: daabdf8fda8525779b9bad16fcdc4d1fd90e2333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# 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 :: forall a. Foo a => a -> [a]
    }

main = do { let r = R {blub = bar}
          ; print (blub r (3::Int))
          ; print (blub r True)
          }