It makes sense (at least to me) that this isn't supported. Elm has a much different type system than JavaScript. I could see converting them in a standard way, but that's a ways off yet.
For now, try encoding to a Json.Encode.Value - you can send that through a port, and it has a standard representation on the JavaScript side. Plus, when you change your model you get to decide whether or not to break compatibility with your encoder. It codifies the contract between the two sides in the specific case of your code. On Friday, March 3, 2017 at 8:22:12 AM UTC-6, Eirik Sletteberg wrote: > > An example use case for this would be when gradually porting an existing > Redux-based app to Elm. > One could rewrite state handling from Redux into Elm updaters/messages, > and wrap the Elm app's main updater, so that after every message is passed > through the updater, it sends the whole state tree through a port, which > would then be picked up by the legacy application's view (it could consist > of React components, for example). > Or one could imagine mapping the state into multiple "ViewModel" objects, > and dispatch them to different ports (one port per ViewModel type?) but > whenever you try to send a tagged union type, there's no support for that > yet. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
