Re:A list of companies using Elm in production
by the_gipsy on Wednesday February 05, 2020 @12:54PM
(#22249311)
I guess Evan really wants that function to get rewritten in Elm - after all it's synchronous.
There should be some built-in asyn request/response mechanism for ports, in the style of the Http module where you specify a Msg for the response. This would work for synchronous stuff too.
Re:A list of companies using Elm in production
by maxthegeek1 on Sunday February 09, 2020 @11:02AM
(#22282696)
For years and years people have been asking for "task ports" which would facilitate synchronous but safe js interop.
As far as I can tell the only reason Evan doesn't include something like task ports is to purposely make interop less convenient (but no more safe) than it needs to be, in order to encourage people to write elm. However, I think this decision will end up biting him at the end of the day.
math.js has a nice `math.evaluate` function for this, that in theory would have the type `String -> Result ParseError Float`, if I could directly assign Elm types to a JS function. However, I can't actually use the function like that. I must treat it as a pub-sub mechanism and define the requisite messages, state, update functions, etc. in order to use it. This turns what should've been a one line call into potentially dozens of lines that also forces an architectural change in how the calling code actually calls the function.
The only other real alternative is to rewrite the functionality I need in Elm.