Related to Karl's Template Haskell suggestion you could also have a look at
quasiquotation:
http://www.haskell.org/haskellwiki/Quasiquotation
The GHC documentation has an example of a expression quoter:
http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html#th-quasiquotati
On Sun, Jun 23, 2013 at 6:36 AM, TP wrote:
> In a more general way, let us suppose I have a Haskell library able to
> perform some calculations: how to use it in a pre-processing step, before
> compilation of the executable?
You are looking for Template Haskell.
http://www.haskell.org/haskellw
Hi everyone,
Consider the following code:
--
import Prelude hiding ((+))
data Expr = Plus Expr Expr | Minus Expr Expr | Expr String deriving Show
f :: Expr -> Int
f (Plus _ _) = 1
f (Minus _ _) = 2
-- infix (f (Plus undefined undefined)) + -- (*)
infix 6 +
(+) :: Expr -> Expr -> E