Hacker News new | ask | show | jobs
by carapace 2542 days ago
That may have changed?

https://guide.elm-lang.org/interop/

> But what happens when you need to do something in JavaScript? Maybe there is a JavaScript library you absolutely need? Maybe you want to embed Elm in an existing JavaScript application? Etc. This chapter will outline all the available options: flags, ports, and custom elements.

I haven't looked at it in depth yet.

1 comments

Ports have always existed. The change was to stop people writing "effect modules" which were the unsafe version of this where you could run arbitrary JS.

The upside to this is that because ports work by message passing, it means that all the language's guarantees can be held even when using them, and packages can't do anything without you knowing about it.

The downside is it is a lot more verbose and awkward. In my opinion, it also makes community contribution to the standard library a lot harder.