
On Mon, Jan 4, 2010 at 12:16 PM, Tom Hawkins
One argument for option 2 is to carry forward datatypes to the target language. For example, if you want to describe a state machine with the state as a type:
What do you mean "carry forward". Can you elaborate on your simple example? What about it requires option 2?
data StopLightState = Red | Yellow | Green
With option 1, values of type StopLightState will be resolved at compile-time, not run-time. (yes, there's tricks to get around this, but they're ugly)
I experimented briefly with option 2 using YHC, but quickly threw in the cards for option 1.
It would be nice if GHC's internals were more accessible for this type of work.
On Mon, Jan 4, 2010 at 6:20 PM, Jasper Van der Jeugt
wrote: Hello, I see no real reason to use the second approach, unless you're doing something tremendously new and big. Besides, the first solution is much easier and will be easier to maintain (in case the back end changes). Kind regards, Jasper Van der Jeugt
On Mon, Jan 4, 2010 at 6:14 PM, CK Kashyap
wrote: Hi, I am not sure if I'm using DSL in the right context here but I am referring to those solutions that allow us to write code in Haskell and generate a target code source code of another language or even object code for that matter. I am aware of two ways of achieving this - 1. Implement functions that emit the target code - that is, when the Haskell code is compiled and run, the target code is emitted 2. Modify the Haskell compiler's back end to emit the code - that is when the Haskell code is compiled the target code is emitted
I am not sure if there are more ways (hybrid perhaps) ...
My question is, when would I chose one approach over the other?
Regards, Kashyap
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe