Hi everyone, I've been thinking for several months now about a useful abstraction for loading data from the server. It's painful to work with HTTP and JSON directly because you lack: caching, logic to not send a request already in flight again, error handling, and so on.
I came upon the idea that the client (that's you) will provide a type alias for each resource's attributes (and perhaps other crucial information), and I could generate code that would retrieve resources of those types. Generating code also allows the tool to create JSON encoders and decoders, a common pain point. Each resource gets its own module with a standard set of functions. I've split out loading a resource (making a request if one is necessary) from getting a resource (obtaining it immediately from information available, if possible). Keeping track of what's been loaded requires an opaque Store model and StoreUpdate message. I don't have this anywhere near usable yet; I haven't started working on the generating part of this at all. I first want to write the code I want to be generated by hand, and get feedback on that. Does this approach seem okay? Are there any problems you can envision? What you be good to work on next? Have a look here: https://github.com/mgold/elm-data/tree/master -- 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 it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.