summaryrefslogtreecommitdiff
path: root/testsuite/tests/safeHaskell/unsafeLibs/BadImport03.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/safeHaskell/unsafeLibs/BadImport03.hs')
-rw-r--r--testsuite/tests/safeHaskell/unsafeLibs/BadImport03.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/unsafeLibs/BadImport03.hs b/testsuite/tests/safeHaskell/unsafeLibs/BadImport03.hs
new file mode 100644
index 0000000000..835009a276
--- /dev/null
+++ b/testsuite/tests/safeHaskell/unsafeLibs/BadImport03.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE Safe #-}
+{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-}
+
+-- | Here we used typeable to produce an illegal value
+-- Now using SAFE though so will fail
+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 ()
+