On Friday, January 13, 2017 at 10:10:28 AM UTC-7, Joey Eremondi wrote:
>
> Even a direct Elm to OCaml translation wouldn't be too hard. Elm is not 
> the same as OCaml, but my understanding is that most of its features are 
> included in Elm (row polymorphism, strict evaluation, 
> first-class-functions). OCaml has lots of features Elm doesn't want (like 
> mutable references) but that's not a problem, and could even allow for some 
> nice backend optimizations.
>
> This would also provide a really nice way to do Elm on the backend. The 
> big question is, how to write such a translator? Are the Haskell libraries 
> for generating OCaml? Or would the compiler need to be written in OCaml?
>

No clue about Haskell libraries, but at the very least you could just do a 
textual translation from Haskell.  However by using the OCaml compiler 
libraries you'd save time and it would save a lot of code regardless.

And yep, OCaml has everything that Elm uses and a lot more that could be 
used for some optimizations, but to start a direct translation would be 
easy.

Even the direct OCaml code is 'almost' identical to Elm.  You know the 
normal ELM Form example at http://elm-lang.org/examples/form?  Here is the 
same thing in OCaml:
https://github.com/OvermindDL1/bucklescript-testing/blob/master/src/main_form.ml
'Almost' identical, and some of the non-identical parts are just minor API 
changes in this example.

But yes, translating Elm to OCaml/Bucklescript would not at all be a hard 
task.  :-)

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to