Yeah, the original JSON is structured poorly. At first I did want to change it the way you describe, but I decided to keep it.
My thinking was that I might have to deal with other poorly structured JSON APIs in the future, but as you say, it has only made things more difficult.
Your second example is really nice to read - it's this kind of code I want to write. I would have gotten there sooner if I hadn't been so stubborn about the JSON shape, so that's a good lesson.
Also, I gotta say your first example is spectacular - the duplication at line 29 and 30 (List.map2 viewUnnamedPlanet) the nesting at line 78 (bodiesDecoder) are pure poetry. :D
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yeah, the original JSON is structured poorly. At first I did want to change it the way you describe, but I decided to keep it.
My thinking was that I might have to deal with other poorly structured JSON APIs in the future, but as you say, it has only made things more difficult.
Your second example is really nice to read - it's this kind of code I want to write. I would have gotten there sooner if I hadn't been so stubborn about the JSON shape, so that's a good lesson.
Also, I gotta say your first example is spectacular - the duplication at line 29 and 30 (List.map2 viewUnnamedPlanet) the nesting at line 78 (bodiesDecoder) are pure poetry. :D