Re: [elm-discuss] Sending tagged unions through ports

2017-03-03 Thread Peter Damoc
On Fri, Mar 3, 2017 at 3:08 PM, 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.
>
> What you seam to want is automated marhalling and unmarshalling of tagged
unions. This is not yet possible.
You can achieve the functionality you want but you will have to write your
own encoders and decoders and have the tagged unions travel the border as
String or Value.



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Sending tagged unions through ports

2017-03-03 Thread Eirik Sletteberg
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.