Announcement: philip2 - an Elm-to-Bucklescript compiler


#1

Hey folks, we wrote an Elm-to-Bucklescript compiler to help us make the transition to Bucklescript. It’s now open source:

Announcement: https://medium.com/@paulbiggar/philip2-an-elm-to-reasonml-compiler-a210aaa6cd04

GitHub: https://github.com/darklang/philip2

Would love to hear any feedback people have from using it!


#2

This looks really cool, I posted this comment on Medium but I’m curious what led you to stop using Elm and start using OCaml?


#3

Sorry, seems you answered here: https://www.reddit.com/r/elm/comments/ac7n3e/philip2_an_elmtoreasonml_compiler_paul_biggar/ed5y9yb/

Basically no way to call to JavaScript directly broke a bunch of their app.


#4

Hey, yes that’s right (see also https://discourse.elm-lang.org/t/elm-to-bucklescript-compiler/2871/7).

Bucklescript’s JS interop is much more flexible than Elm’s, but Elm 0.18 allowed you to call JS pretty directly. That’s no longer the case unfortunately in Elm 0.19, and our attempt to make it work went nowhere.


#5

Hi pbiggar - I also have big problems caused Elm 0.19 restriction on native modules. Could you describe how you attempted to make it work? I’m thinking of ways that I might be able to work around the issue. Without having looked into it too much, I was imagining that I could just mimic the way that the elm-core and elm-explorations do it - I don’t mind having an elm.json file that has wrong info (e.g. claims to be part of elm-explorations). In terms of installing 3rd party things, it gets harder that way, but still possible.

Would this approach not work? Did you explore other approaches?

Thanks!


#6

The approach we tried was very similar to (though not quite as nice as) https://medium.com/@jjant/making-elm-unsafe-cc6435495af2.