Skip to content

Instantly share code, notes, and snippets.

@gleber
Created May 30, 2015 09:44
Show Gist options
  • Save gleber/8fc2e069663d63fd7755 to your computer and use it in GitHub Desktop.
Save gleber/8fc2e069663d63fd7755 to your computer and use it in GitHub Desktop.
import Language.Haskell.TH
f n m = do
nm1 <- newName "x"
let b = replicate (m - 1) WildP
a = replicate (n - m) WildP
return (LamE [TupP (b++[VarP nm1]++a)] (VarE nm1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment