blob: 2bcea65c95c1e9e7d136b018d6273eb51f5fc2f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-- Test restricted functionality: GeneralizedNewtypeDeriving
:unset +s
:set -XSafe
:set -XGeneralizedNewtypeDeriving
class Op a where { op :: a -> String }
data T = A | B | C deriving (Show)
instance Op T where { op _ = "T" }
newtype T1 = T1 T
instance Op T1 where op _ = "t1"
newtype T2 = T2 T deriving (Op)
let x = T1 A
let y = T2 A
op x
op y
|