Created
April 14, 2012 07:10
-
-
Save xenophobia/2382581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-} | |
import Language.Haskell.TH | |
import Control.Monad | |
mapT :: Int -> ExpQ -> ExpQ | |
mapT count f = do | |
vars <- replicateM count $ newName "x" | |
lamE [tupP $ map varP vars] (tupE $ map (appE f . varE) vars) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment