summaryrefslogtreecommitdiff
path: root/testsuite/tests/safeHaskell/ghci/p16.script
blob: a4b829c9d80b199a97806f0de3fba8709dbf66ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
:set -XHaskell2010
-- 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