summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TupleN.hs
blob: be8618ecd38b27cc580413c82dabe7446f72bf13 (plain)
1
2
3
4
5
6
7
8
9
10
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)]]