blob: 80eba6288fad14d5436d9125a72fd243c5dfb773 (
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
27
|
{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-}
-- | Here we used typeable to produce an illegal value
module Main where
import Data.OldTypeable
import BadImport02_A
deriving instance Typeable Nat
data NInt = NInt Int deriving Show
instance Typeable NInt where
typeOf _ = typeOf (undefined::Nat)
main = do
let a = succ' $ zero
Just n@(NInt z) = (cast a) :: Maybe NInt
n' = NInt (-z)
Just m = (cast n') :: Maybe Nat
putStrLn $ showNat a
putStrLn $ show n
putStrLn $ showNat m
return ()
|