summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TupleN.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/ghc86/TupleN.hs')
-rw-r--r--tests/examples/ghc86/TupleN.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/examples/ghc86/TupleN.hs b/tests/examples/ghc86/TupleN.hs
new file mode 100644
index 0000000..be8618e
--- /dev/null
+++ b/tests/examples/ghc86/TupleN.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TemplateHaskell #-}
+module TupleN where
+import Language.Haskell.TH
+
+tuple :: Int -> ExpQ
+tuple n = [|\list -> $(tupE (exprs [|list|])) |]
+ where
+ exprs list = id [infixE (Just (list))
+ (varE '(!!))
+ (Just (litE $ integerL (toInteger num)))
+ | num <- [0..(n - 1)]]