Great write up! Thank you very much for sharing your experience with us.
I cached two errors when trying your code in Ellie.
individualDecoder
individualDecoder : Decoder Individual individualDecoder = Decode.map4 (\id species name owner -> Individual id species name owner) (Decode.field "id" Decode.int) (Decode.field "species" Decode.string) (Decode.field "name" Decode.string) (Decode.maybe <| Decode.field "owner" Decode.int)
addIfPet
addIfPet : Individual -> Dict Int (List Pet) -> Dict Int (List Pet) addIfPet individual petsCaredFor = case pet individual of Nothing -> petsCaredFor Just newPet -> case individual.owner of Just ownerid -> Dict.update ownerid (Just << addOrInit newPet) petsCaredFor _ -> petsCaredFor
I made the change accordingly in my Ellie and print some debug info on screen to visualize the decoding and converting process
Amazing, thank you! Would you be okay if I linked your Ellie instead of mine from the post? I'll attribute it to you of course!
Sure, That's totally fine. I'm glad it helped.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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.
Great write up! Thank you very much for sharing your experience with us.
I cached two errors when trying your code in Ellie.
individualDecoder
should be like this:addIfPet
function should be like this:I made the change accordingly in my Ellie and print some debug info on screen to visualize the decoding and converting process
Amazing, thank you! Would you be okay if I linked your Ellie instead of mine from the post? I'll attribute it to you of course!
Sure, That's totally fine. I'm glad it helped.