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.
