aboutsummaryrefslogtreecommitdiff
path: root/html-test/src/Bug679.hs
diff options
context:
space:
mode:
authorAlexander Biehl <alexbiehl@gmail.com>2018-06-14 15:28:52 +0200
committerGitHub <noreply@github.com>2018-06-14 15:28:52 +0200
commit6247ec8b5a5bc8145ce851dce11eb617a380381c (patch)
tree7856c0dd1ddd0c1f3eef0422b0cd8e8a5a6b71cb /html-test/src/Bug679.hs
parent9a7f539d0c20654ff394f2ff99836412a6844df1 (diff)
parent095fa970b32c818ed4c06cefc00ba98aaff756fa (diff)
Merge pull request #857 from sjakobi/ghc-head-update-3
Update ghc-head
Diffstat (limited to 'html-test/src/Bug679.hs')
-rw-r--r--html-test/src/Bug679.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/html-test/src/Bug679.hs b/html-test/src/Bug679.hs
new file mode 100644
index 00000000..dba194c4
--- /dev/null
+++ b/html-test/src/Bug679.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module Bug679 where
+
+import Language.Haskell.TH
+
+data Bar a = Bar
+
+$(do
+ a <- newName "a"
+
+ let classN = mkName "Foo"
+ let methodN = mkName "foo"
+
+ methodTy <- [t| $(varT a) -> $(varT a) |]
+ let cla = ClassD [] classN [PlainTV a] [] [SigD methodN methodTy]
+
+ -- Note that we are /reusing/ the same type variable 'a' as in the class
+ instanceHead <- [t| $(conT classN) (Bar $(varT a)) |]
+ idCall <- [e| id |]
+ let ins = InstanceD Nothing [] instanceHead [FunD methodN [Clause [] (NormalB idCall) []]]
+
+ pure [cla,ins])
+