Joey | 1 Jan 06:38 2014
Picon

Standard way to translate Haskell to other languages?

I'm looking at writing a simple Haskell to Elm translator. Thankfully, 
the Elm compiler is in Haskell, so I'm just trying transforming syntax 
trees.

I'm wondering, is there a standard way to do this sort of thing? 
Template Haskell looked promising, but it seems there isn't much of a 
way to do introspection on function definition. Has there been any 
work/progress on this?

The GHC API seemed useful for compiling, but it seems tricky to use, and 
I haven't been able to find many tutorials for this sort of thing. I 
could just be looking in the wrong place.

What are the ways I could go about this? Are there any similar projects 
I could use as reference? What packages are useful for generating and 
manipulating Haskell ASTs? Does anybody have experience in this area 
they could share?

I've posted a similar question to the Haskell Reddit at 
http://www.reddit.com/r/haskell/comments/1u55rl/standard_way_to_translate_haskell_to_other/.

Thanks!

Joey Eremondi
Malcolm Wallace | 1 Jan 12:13 2014

Re: Standard way to translate Haskell to other languages?


On 1 Jan 2014, at 05:38, Joey wrote:

> I'm looking at writing a simple Haskell to Elm translator. Thankfully, the Elm compiler is in Haskell, so
I'm just trying transforming syntax trees.
> 
> I'm wondering, is there a standard way to do this sort of thing? 

Yes.  Use the haskell-src-exts parser.  It gives you a somewhat standard syntax tree.  Then you can use
straight pattern-matching equations for transformation, or if that leads to lots of boilerplate code,
then something like uniplate can be useful.

Regards,
   Malcolm 
Ömer Sinan Ağacan | 1 Jan 14:24 2014
Picon

Re: Standard way to translate Haskell to other languages?

Compiling Haskell to another language is huge effort, maybe instead of
this you can compile Haskell to JS using GHCJS or Fay, and then use
Elm FFI to use compiled Haskell functions.

---
Ömer Sinan Ağacan
http://osa1.net

2014/1/1 Joey <jmitdase <at> gmail.com>:
> I'm looking at writing a simple Haskell to Elm translator. Thankfully, the
> Elm compiler is in Haskell, so I'm just trying transforming syntax trees.
>
> I'm wondering, is there a standard way to do this sort of thing? Template
> Haskell looked promising, but it seems there isn't much of a way to do
> introspection on function definition. Has there been any work/progress on
> this?
>
> The GHC API seemed useful for compiling, but it seems tricky to use, and I
> haven't been able to find many tutorials for this sort of thing. I could
> just be looking in the wrong place.
>
> What are the ways I could go about this? Are there any similar projects I
> could use as reference? What packages are useful for generating and
> manipulating Haskell ASTs? Does anybody have experience in this area they
> could share?
>
> I've posted a similar question to the Haskell Reddit at
> http://www.reddit.com/r/haskell/comments/1u55rl/standard_way_to_translate_haskell_to_other/.
>
> Thanks!
(Continue reading)

Joey | 2 Jan 05:08 2014
Picon

Re: Standard way to translate Haskell to other languages?

It would be hard, but the languages are nearly identical, so the 
translation is pretty trivial AST transforming. I'm also not looking to 
be complete: my main goal is sharing client and server-side code.
Thanks to Malcolm Wallace for the haskell-src-extensions suggestion, it 
looks great.

On 14-01-01 07:24 AM, Ömer Sinan Ağacan wrote:
> Compiling Haskell to another language is huge effort, maybe instead of
> this you can compile Haskell to JS using GHCJS or Fay, and then use
> Elm FFI to use compiled Haskell functions.
>
> ---
> Ömer Sinan Ağacan
> http://osa1.net
>
>
> 2014/1/1 Joey <jmitdase <at> gmail.com>:
>> I'm looking at writing a simple Haskell to Elm translator. Thankfully, the
>> Elm compiler is in Haskell, so I'm just trying transforming syntax trees.
>>
>> I'm wondering, is there a standard way to do this sort of thing? Template
>> Haskell looked promising, but it seems there isn't much of a way to do
>> introspection on function definition. Has there been any work/progress on
>> this?
>>
>> The GHC API seemed useful for compiling, but it seems tricky to use, and I
>> haven't been able to find many tutorials for this sort of thing. I could
>> just be looking in the wrong place.
>>
>> What are the ways I could go about this? Are there any similar projects I
(Continue reading)

Carter Schonwald | 2 Jan 05:19 2014
Picon

Re: Standard way to translate Haskell to other languages?

have you considered using GHCJS? 


On Wed, Jan 1, 2014 at 11:08 PM, Joey <jmitdase <at> gmail.com> wrote:
It would be hard, but the languages are nearly identical, so the translation is pretty trivial AST transforming. I'm also not looking to be complete: my main goal is sharing client and server-side code.
Thanks to Malcolm Wallace for the haskell-src-extensions suggestion, it looks great.


On 14-01-01 07:24 AM, Ömer Sinan Ağacan wrote:
Compiling Haskell to another language is huge effort, maybe instead of
this you can compile Haskell to JS using GHCJS or Fay, and then use
Elm FFI to use compiled Haskell functions.

---
Ömer Sinan Ağacan
http://osa1.net


2014/1/1 Joey <jmitdase <at> gmail.com>:
I'm looking at writing a simple Haskell to Elm translator. Thankfully, the
Elm compiler is in Haskell, so I'm just trying transforming syntax trees.

I'm wondering, is there a standard way to do this sort of thing? Template
Haskell looked promising, but it seems there isn't much of a way to do
introspection on function definition. Has there been any work/progress on
this?

The GHC API seemed useful for compiling, but it seems tricky to use, and I
haven't been able to find many tutorials for this sort of thing. I could
just be looking in the wrong place.

What are the ways I could go about this? Are there any similar projects I
could use as reference? What packages are useful for generating and
manipulating Haskell ASTs? Does anybody have experience in this area they
could share?

I've posted a similar question to the Haskell Reddit at
http://www.reddit.com/r/haskell/comments/1u55rl/standard_way_to_translate_haskell_to_other/.

Thanks!

Joey Eremondi

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Joey | 2 Jan 07:06 2014
Picon

Re: Standard way to translate Haskell to other languages?

It looked interesting, but when I initially started my project (about six months ago) it seemed pretty immature. It also seems to be less focused on graphical programming, which Elm is superb at with its FRP. I'd also heard GHCJS was pretty heavyweight, getting the entire runtime going. I'm really only using JS for rednering.

On 14-01-01 10:19 PM, Carter Schonwald wrote:
have you considered using GHCJS? 


On Wed, Jan 1, 2014 at 11:08 PM, Joey <jmitdase <at> gmail.com> wrote:
It would be hard, but the languages are nearly identical, so the translation is pretty trivial AST transforming. I'm also not looking to be complete: my main goal is sharing client and server-side code.
Thanks to Malcolm Wallace for the haskell-src-extensions suggestion, it looks great.


On 14-01-01 07:24 AM, Ömer Sinan Ağacan wrote:
Compiling Haskell to another language is huge effort, maybe instead of
this you can compile Haskell to JS using GHCJS or Fay, and then use
Elm FFI to use compiled Haskell functions.

---
Ömer Sinan Ağacan
http://osa1.net


2014/1/1 Joey <jmitdase <at> gmail.com>:
I'm looking at writing a simple Haskell to Elm translator. Thankfully, the
Elm compiler is in Haskell, so I'm just trying transforming syntax trees.

I'm wondering, is there a standard way to do this sort of thing? Template
Haskell looked promising, but it seems there isn't much of a way to do
introspection on function definition. Has there been any work/progress on
this?

The GHC API seemed useful for compiling, but it seems tricky to use, and I
haven't been able to find many tutorials for this sort of thing. I could
just be looking in the wrong place.

What are the ways I could go about this? Are there any similar projects I
could use as reference? What packages are useful for generating and
manipulating Haskell ASTs? Does anybody have experience in this area they
could share?

I've posted a similar question to the Haskell Reddit at
http://www.reddit.com/r/haskell/comments/1u55rl/standard_way_to_translate_haskell_to_other/.

Thanks!

Joey Eremondi

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Carter Schonwald | 2 Jan 07:17 2014
Picon

Re: Standard way to translate Haskell to other languages?

oh, in that case you should check out three-peny gui! hackage.haskell.org/package/threepenny-gui



On Thu, Jan 2, 2014 at 1:06 AM, Joey <jmitdase <at> gmail.com> wrote:
It looked interesting, but when I initially started my project (about six months ago) it seemed pretty immature. It also seems to be less focused on graphical programming, which Elm is superb at with its FRP. I'd also heard GHCJS was pretty heavyweight, getting the entire runtime going. I'm really only using JS for rednering.


On 14-01-01 10:19 PM, Carter Schonwald wrote:
have you considered using GHCJS? 


On Wed, Jan 1, 2014 at 11:08 PM, Joey <jmitdase <at> gmail.com> wrote:
It would be hard, but the languages are nearly identical, so the translation is pretty trivial AST transforming. I'm also not looking to be complete: my main goal is sharing client and server-side code.
Thanks to Malcolm Wallace for the haskell-src-extensions suggestion, it looks great.


On 14-01-01 07:24 AM, Ömer Sinan Ağacan wrote:
Compiling Haskell to another language is huge effort, maybe instead of
this you can compile Haskell to JS using GHCJS or Fay, and then use
Elm FFI to use compiled Haskell functions.

---
Ömer Sinan Ağacan
http://osa1.net


2014/1/1 Joey <jmitdase <at> gmail.com>:
I'm looking at writing a simple Haskell to Elm translator. Thankfully, the
Elm compiler is in Haskell, so I'm just trying transforming syntax trees.

I'm wondering, is there a standard way to do this sort of thing? Template
Haskell looked promising, but it seems there isn't much of a way to do
introspection on function definition. Has there been any work/progress on
this?

The GHC API seemed useful for compiling, but it seems tricky to use, and I
haven't been able to find many tutorials for this sort of thing. I could
just be looking in the wrong place.

What are the ways I could go about this? Are there any similar projects I
could use as reference? What packages are useful for generating and
manipulating Haskell ASTs? Does anybody have experience in this area they
could share?

I've posted a similar question to the Haskell Reddit at
http://www.reddit.com/r/haskell/comments/1u55rl/standard_way_to_translate_haskell_to_other/.

Thanks!

Joey Eremondi

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane