blob: 528f0ea238e5deab22f1e628bd69d6387a49b495 (
plain)
1
2
3
4
5
6
7
8
9
10
|
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)]]
|