Re: [elm-discuss] Re: How to decode a recursive JSON from a port?

2016-11-14 Thread Brian Hicks
I had to do this myself recently. The general solution is that for any recursive definition you have to have a lambda between the definition and it's use. Your example 1 does this in the decoder with the call to `lazy`. Example 2 doesn't, so it fails. I've heard (but haven't checked) that the

Re: [elm-discuss] Re: How to decode a recursive JSON from a port?

2016-10-05 Thread Wil Chung
Ah. Dammit. It must have been late. I had put in a JS object, gotten another error, and thought it was because of the same problem. Then, subsequently, how do I write the childrenDecoder for a recursive model? I'm doing the customDecoder, but I'm getting the error: "TypeError: Cannot read

[elm-discuss] Re: How to decode a recursive JSON from a port?

2016-10-05 Thread Max Goldstein
To clarify Rupert: try removing the JSON.stringify call. Elm expects actual objects, not a string representation of objects. I think. -- 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

[elm-discuss] Re: How to decode a recursive JSON from a port?

2016-10-05 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, October 5, 2016 at 11:40:24 AM UTC+1, Rupert Smith wrote: > > On Wednesday, October 5, 2016 at 11:15:13 AM UTC+1, Wil C wrote: >> >> Hi all, >> >> Thanks again for all your help. And when I've asked questions last year. >> >> I have another question. Here's my situation. I want to

[elm-discuss] Re: How to decode a recursive JSON from a port?

2016-10-05 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, October 5, 2016 at 11:15:13 AM UTC+1, Wil C wrote: > > Hi all, > > Thanks again for all your help. And when I've asked questions last year. > > I have another question. Here's my situation. I want to pass a json from a > port, and decode the json into records. > > The recursive