diff options
Diffstat (limited to 'testsuite/tests/th/T3845.hs')
-rw-r--r-- | testsuite/tests/th/T3845.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/th/T3845.hs b/testsuite/tests/th/T3845.hs new file mode 100644 index 0000000000..29dc51fbda --- /dev/null +++ b/testsuite/tests/th/T3845.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE TemplateHaskell #-} + +module THBug1 where + +import Language.Haskell.TH +import Language.Haskell.TH.Syntax + +data HCons a b = HCons a b +data HNil = HNil + +mhlt :: [Q Type] -> Q Type +mhlt xss = [t| $(foldThing xss)|] + where + foldThing (x:xs) = [t| HCons $x $(foldThing xs)|] + foldThing [] = [t| HNil |] + +mhlt1 :: [Int] -> Q Exp +mhlt1 xss = [| $(foldThing1 xss) |] + where + foldThing1 (x:xs) = [| x : $(foldThing1 xs)|] + foldThing1 [] = [| [] |] |