News for hackers. Stuff that matters.
Re:Integrating Elm and Phoenix Channels via Elm-Phoenix-socket by shados on Monday June 06, 2016 @08:47PM (#11851636)
PureScript is a good example.

The problem isn't that it doesn't work. It's that what you do with ports only work in the context of your application. The JavaScript part has to be defined somewhere else, the Elm code assumes the JavaScript part will be there. You can't redistribute that easily.

How to make it better? that's easy. IT ALREADY EXISTS and is part of Elm. It's just a private API. But it totally does work. It's how the native wrappers are written.

Ports use publisher/subscriber. If I want to, let say, wrap moment.js, which is just a bunch of synchronous functions, how would I do it? Dispatch side effects to "compute dates" and listen to the "response" in my update method? That would be silly.

The port system works beautifully to interface with the outside world. It is very poor to bring the outside world in.

Re:Integrating Elm and Phoenix Channels via Elm-Phoenix-socket by bbcbasic on Monday June 06, 2016 @09:33PM (#11851832)
> How to make it better? that's easy. IT ALREADY EXISTS and is part of Elm. It's just a private API. But it totally does work. It's how the native wrappers are written.

You mean like this: https://github.com/mcapodici/capodicis-notes/blob/master/elm...

That is an example where I connected chrome extension storage functionality using native wrappers.

This is the Elm wrapping for it:

https://github.com/mcapodici/capodicis-notes/blob/master/elm...

Re:Integrating Elm and Phoenix Channels via Elm-Phoenix-socket by efficax on Monday June 06, 2016 @11:53PM (#11852291)
The Native interop changed with core >= 4.0, so that relatively straightforward way of accessing native js no longer works, and the new Native is (deliberately, I believe) undocumented.
Re:Integrating Elm and Phoenix Channels via Elm-Phoenix-socket by bbcbasic on Tuesday June 07, 2016 @02:57AM (#11852858)
That's Elm's weakness then. The goalposts keep moving.
Re:Integrating Elm and Phoenix Channels via Elm-Phoenix-socket by knewter on Tuesday June 07, 2016 @10:20AM (#11854675)
In a pre-1.0 language, this should be entirely expected. It's bleeding edge a bit, but I've yet to find someone who used it to build something non-trivial and wasn't sold on it. There's definitely some survivor bias there, obviously.

For the record, I looked at Elm over 2 years ago and completely dismissed it. I regret that strongly now as I am extreeeeemely happy developing with it and I can build stuff in far shorter timelines with zero runtime errors than I could in react even (which was a high-watermark before Elm for me in that respect)