-
-
Save haitlahcen/de33a593added86f86fc9a126d5b4164 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
# ======================================== header.h ============================================= | |
#define TRUE 1 | |
# ======================================== X.hs ================================================= | |
module X where | |
x = 1 | |
# ======================================== Test.hs ============================================== | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE CPP #-} | |
module Test where | |
import X | |
import GHC.Types | |
import Control.Monad | |
import Language.Haskell.TH | |
#include "header.h" | |
curryN :: Int -> Q Exp | |
curryN n = do | |
f <- newName "f" | |
xs <- replicateM n (newName "x") | |
let args = map VarP (f:xs) | |
ntup = TupE (map VarE xs) | |
return $ LamE args (AppE (VarE f) ntup) | |
data List a = Nil | Cons a (List a) | |
x = Cons 4 (Cons 2 Nil) | |
y = TRUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment