HeinrichApfelmus / threepenny-gui

GUI framework that uses the web browser as a display.
https://heinrichapfelmus.github.io/threepenny-gui/
Other
439 stars 77 forks source link

Update `driver.js` to fit with the new JSON encoding of sum types #73

Closed kfl closed 10 years ago

kfl commented 10 years ago

Update driver.js to fit with the JSON encoding of sum types that Data.Aeson.genericToJSON use. Thus really fixing #71.

HeinrichApfelmus commented 10 years ago

Thanks! However, as mentioned, in this case I prefer to make an explicit ToJSON instance, so that the communication protocol is specified entirely within the Threepenny source code and does not rely on (non-existing) documentation of the aeson library (at least for aeson-0.6).

kfl commented 10 years ago

I agree that making the ToJSON instance explicit is better.

However, I don't think that it is the right JSON encoding, so I have made an updated version that mimics genericToJSON rather than Data.Aeson.Generic. This is done so that we can avoid the for(var key in event) construct in driver.js which is both brittle and somewhat non-deterministic.

HeinrichApfelmus commented 10 years ago

Sounds good to me, thanks!