Re: [elm-discuss] Decoding JSON to Union types.

2017-03-01 Thread Dan Willis
Thanks so much, Peter & Brian, I had earlier found your article re: dates, but revisiting it now has helped! Yep, I like the idea of keeping that function as agnostic as possible, i.e., out of a Decoder. Thanks again for your help, I really appreciate it. On Thursday, 2 March 2017 03:40:12

Re: [elm-discuss] Decoding JSON to Union types.

2017-03-01 Thread Brian Hicks
Seconding what Peter said! I think the approach you've got here (String -> OrderStatus) is good. If you don't specialize it to a decoder you can do a lot more with it (testing, other serialization methods.) Composing those functions together is the way to go. I've also written about this, but

[elm-discuss] Decoding JSON to Union types.

2017-02-28 Thread Dan Willis
I'm new to Elm (I'm <2 weeks in) but am really loving it. However, I'm finding it difficult to determine just how to successfully decode a JSON object into my model, what with changes between versions, and the number of related non-core packages. Here's an example of the JSON data: [ {