Generating programs with Haskell
I need to auto-generate some programs with Haskell. What is the best architecture for this, which enforce semantic rules with the t开发者_如何学Cype system, or other haskell-cleverness? Otherwise I would just have lists of statements:
type program = [Statement]
data Statement =
Variable x |
IfStatement Condition [Statement] |
...
If you mean you are generating haskell, check out Template Haskell
Perhaps you'll like to have a look at HStringTemplate. It could help if You are already experienced with "StringTemplate" (which was implemented in Java initially?).
精彩评论