So just to solidify and condense some of the suggestions on here, it seems to be:
- Start with the data (impossible states and make data structures)
- Loading states might be best as custom
types - Potentially use non-empty lists …
Or default data in yourSee belowjson(instead of aMaybe)?- But
Maybetypes are fine to use, as isMaybe.withDefault.
Maybe.withDefault
@wolfadex I quite like that approach, do you normally just use it for a string or do you also use for other data types?
I understand the general idea or FindKeyedShape, but I can’t quite visualise how that search function might work.
Caseing on a loading type …
@ChrisWellsWood I’ve seen this method before of caseing on your model
for noop, loading, loaded, failed which makes sense … but could you expand a little on your custom type records? I understand Page (a title and it’s body), but …
- Why are you naming things
mTokenandtoken? What do they stand for? - How do you pass your
loadeddata to updatePageandviewwhen it’s loaded? (I’m assumingMyPageDatais the decoder?)
Impossible states
@dta Do you personally have any other examples you could add to that line of thought? Simple ones ideally.
What would a Maybe type look like in the json?
I’m splitting this out into another question, as it brings up the question how to save and represent a type in the json file, be it a Maybe or a type Custom.