On Monday, October 24, 2016 at 1:15:14 PM UTC-7, Peter Damoc wrote: > > Think about the role that a ORM is playing. What I want to understand is > what would a functional equivalent would look like in Elm. > > What would sit above graphQL or REST or some other lower level tech? > > Another way to look at this would be to take the Json.Decode/Encode as > example and imagine that one has the equivalent of a Decoder only that it > would be some kind of a descriptor used by some lower level library that > does the queries based on that descriptor data. > Maybe this descriptor uses something like Datalog. >
Unless I'm mistaken, that is the goal I have set for elm-postgrest <https://github.com/john-kelly/elm-postgrest>. The equivalent of a `Decoder` in my library is a `Query`. I build the Query up in the same fashion that Decoders are built (with some extra functionality for filtering and ordering and such). The high level `Query` (descriptor as you called it) is then converted into an PostgREST compliant HTTP Request. I have yet to work out the write api -- which is undoubtably a large portion -- however I am convinced (egotistical, i know) that the library is moving in the right direction. I think the tricky part is that the API/functionality of the client is tightly coupled to to functionality of the server. This is why I have scoped my library to *only *support PostgREST. It is not always the case that the server supports all of the things (nesting, filtering, ordering, pagination, limit, offset, etc). I am unsure if you are suggesting that a general API *could *exist which encompasses all backends. I originally tried to create a general API, but quickly came to the conclusion that such a task was quite tricky. Overall, (once again sorry for the plug) I think that elm-postgrest <https://github.com/john-kelly/elm-postgrest> has made some decent steps in the right direction, and I think a more thorough audit / usage of the code could bring this conversation to another level. (also, for those too lazy to look up PostgREST -- it's basically the same as graphql -- but 0 coding required. some fancy people might say "isomorphic") -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
