Op donderdag 10 november 2016 23:35:54 UTC+1 schreef Kasey Speakman:
>
> Anybody else run into this?
>

Yeah, I ran into this, but in a slightly different variant. My structure 
did not have the Maybe types. It was something like this:

port newRecordForElm : (Record -> msg) -> Sub msg

type alias Record =
  { someList : List (Int) 
  , name : String 
  }


To deal with the a) null values and b) missing values, 
I resorted to passing the Json through the port, and decode in Elm, like 
this:

import Json.Decode as JD
---
port newRecordForElm : (JD.Value -> msg) -> Sub msg

modelDecoder : JD.Decoder Record
modelDecoder =
  JD.object2 Record
    ( JD.oneOf [ "someList" := JD.list JD.int, JD.succeed [] ] )
    ( JD.oneOf [ "name" := JD.string, JD.succeed "" ] )

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