blob: 80097a8f24a178e988c6096f55ba7cabe778d11c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
}
|