diff options
Diffstat (limited to 'testsuite/tests/safeHaskell/unsafeLibs/BadImport02.hs')
-rw-r--r-- | testsuite/tests/safeHaskell/unsafeLibs/BadImport02.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/unsafeLibs/BadImport02.hs b/testsuite/tests/safeHaskell/unsafeLibs/BadImport02.hs new file mode 100644 index 0000000000..e9d5ca7577 --- /dev/null +++ b/testsuite/tests/safeHaskell/unsafeLibs/BadImport02.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-} + +-- | Here we used typeable to produce an illegal value +module Main where + +import Data.Typeable + +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 () + |