summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/th/T3899a.hs
blob: 2ac985136f27c583fd28cf14a7e75bc44f94feb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{-# LANGUAGE TemplateHaskell #-}
module T3899a where


import Language.Haskell.TH
import Control.Monad

data Cons a b = Cons a b
data Nil = Nil

nestedTuple n = do
     xs <- replicateM n (newName "x")
     return $ LamE [foldr (\v prev -> ConP 'Cons [VarP v,prev]) (ConP 'Nil []) xs]
                   (TupE $ map VarE xs)