summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T3899a.hs
blob: 1b5e7d69c1b83bf658394d423cae2aacedc075c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# 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 -> ParensP (ConP 'Cons [] [VarP v,prev]))
                       (ConP 'Nil [] []) xs]
                   (TupE $ map (Just . VarE) xs)