| It would be good if it contains some explanations. Recently | I have found the following example on the mailing list but I can | only guess what, e.g., "tupP" means. | | sel' :: Int -> Int -> ExpQ | sel' i n = lamE [pat] rhs | where pat = tupP (map varP as) | rhs = varE (as !! (i - 1)) | as = map mkName [ ("a__" ++ show j) | j <- [1..n] ] tupP has type [Q Pat] -> Q Pat http://www.haskell.org/ghc/docs/latest/html/libraries/template-haskell/L anguage-Haskell-TH-Lib.html#v%3AtupP It's a "smart constructor" for patterns, just like the other "smart constructors" described in the original TH paper (section 6.3) http://research.microsoft.com/%7Esimonpj/Papers/meta-haskell/index.htm [In the paper, the type Expr is now ExpQ, or equivalently Q Exp.] Does that help? Simon
participants (1)
-
Simon Peyton-Jones