summaryrefslogtreecommitdiff
path: root/testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs')
-rw-r--r--testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs b/testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs
new file mode 100644
index 0000000000..8d81be6abc
--- /dev/null
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang11_B.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE TemplateHaskell #-}
+module SafeLang11_B ( Class(..), mkSimpleClass ) where
+
+import Language.Haskell.TH
+
+class Class a where
+ c :: a
+
+mkSimpleClass :: Name -> Q [Dec]
+mkSimpleClass name = do
+ TyConI (DataD [] dname [] cs _) <- reify name
+ ((NormalC conname []):_) <- return cs
+ ClassI (ClassD [] cname [_] [] [SigD mname _]) _ <- reify ''Class
+ return [InstanceD [] (AppT (ConT cname) (ConT dname)) [FunD mname
+ [Clause [] (NormalB (ConE conname)) []]]]
+