blob: 81f2033ea60b4a2bf7cb28b8ff337aa08045f434 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
-- Test restricted functionality: Data.Typeable
:unset +s
:set -XSafe
:set -XDeriveDataTypeable
:set -XStandaloneDeriving
:m + Data.OldTypeable
data H = H {h :: String} deriving (Typeable, Show)
data G = G [Int] deriving (Show)
instance Typeable G where { typeOf _ = typeOf (undefined :: H) }
let x = H "Hello"
let y = G [0]
x
y
let (Just y_as_H) = (cast y) :: Maybe H
y_as_H
|