codesnippets:templatehaskell
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| codesnippets:templatehaskell [2022/04/27 01:28] – created f2b216 | codesnippets:templatehaskell [2025/10/08 00:48] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 20: | Line 20: | ||
| return $ LamE args (AppE (VarE f) ntup) | return $ LamE args (AppE (VarE f) ntup) | ||
| </ | </ | ||
| + | |||
| + | ===== Using the created code ===== | ||
| + | |||
| + | * Example, uses the curry function by using the placeholder `$(C.curryN 3)` that will be expanded by ghc<code Haskell> | ||
| + | {-# LANGUAGE TemplateHaskell #-} | ||
| + | |||
| + | module Lib | ||
| + | ( | ||
| + | someFunc | ||
| + | ) where | ||
| + | |||
| + | import qualified Curry as C | ||
| + | |||
| + | someFunc :: IO () | ||
| + | someFunc = | ||
| + | do | ||
| + | print $ $(C.curryN 3) f1 1 ' ' [" | ||
| + | print $ $(C.curryN 3) f1 1 ' | ||
| + | print $ $(C.curryN 3) f1 1 ' | ||
| + | |||
| + | f1 :: (Int, | ||
| + | f1 (ni,ch,[]) = [] | ||
| + | f1 (ni, | ||
| + | f1 (ni, | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== ✎ ===== | ||
| + | ~~DISCUSSION~~ | ||
codesnippets/templatehaskell.1651015723.txt.gz · Last modified: (external edit)
