I've been thinking about this recently because I have some ocaml code I
want to compile to javascript and call from elm, and doing it via json
seems unnecessarily complicated (the elm code already uses the same
algebraic datatypes the ocaml code does). It's definitely easier to insist
that the encoding is strictly conforming (generating is easier than
consuming, after all), so I would be very interested in any work along
those lines.

martin

On Thu, Sep 29, 2016 at 1:46 PM, Riley Eynon-Lynch <[email protected]>
wrote:

> We have 7k lines of Elm in production, and we stopped using it because of
> this pain in the boundary between Elm & JS. The examples from NRI show lots
> of local, elm-internal logic without much API chatter or JS interop. Our
> app has tons of API chatter (realtime collaboration is a feature), and we
> have 40k lines of JS in our main SPA that any newly-elmed component would
> have to talk to.
>
> We found that of our 7k loc, over 1k was in decoders & encoders!
>
>
> On Thursday, September 29, 2016 at 11:54:17 AM UTC-5, Eduardo Cuducos
> wrote:
>>
>> This idea makes a lot of sense to me. We, as developers, could go
>> “automagically” from JSON to Model if they match — and the Json.Decode will
>> still be there if one needs to parse a JSON differently.
>>
>> On Thu, Sep 29, 2016 at 12:36 PM 'Rupert Smith' via Elm Discuss <
>> [email protected]> wrote:
>>
>>> On Thursday, September 29, 2016 at 4:35:06 PM UTC+1, Rupert Smith wrote:
>>>>
>>>> I also have a little problem with the 'roles' encode to solve. At the
>>>> moment I have:
>>>>
>>>>         , ( "roles"
>>>>           , case model.roles of
>>>>                 Just roles ->
>>>>                     roles |> List.map roleEncoder |> Encode.list
>>>>
>>>>                 Nothing ->
>>>>                     Encode.null
>>>>           )
>>>>
>>>> which will mean 'null' is output when the roles are Nothing.
>>>>
>>>
>>> Another option would be if Encode provided 'missing : Value', which
>>> means skip that field, but it doesn't.
>>>
>>> --
>>> 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.
>>>
>> --
> 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.
>

-- 
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.

Reply via email to