You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit hard to explain, but my idea is to spark a discussion about how much graphql-api could benefit from using a proper Record library in some way (it's not clear how to me yet).
So I recently realized that, an object definition in a graphql-api schema is never inhabited with a value per-say. Like, we cannot create a value out of nowhere for it:
typePlant=Object"Plant" '[]
'[ Field"name"Text ]
-- this does not work =>let test =Plant"Olala"-- this does work, but we do not know it's a subtype of Plant though:let (Just foo) = objectFromList [("name", toValue @Text"Olala")]
Of course we can create a resolver (that is a Handler in graphql-api) which can "sort of" create a graphql-api's Value's AST which will correspond to a "subtype" of Plant here.
Now this behavior is actually the very essence of graphql, so no problem. My point is, there should be a way to get back the fact that it's a Plant type, and a way to create an ad-hoc plant-type value. Probably the best way is to finalize the implementation of #192 . But I feel like this should be kept at the type level on haskell's side, and perhaps records or some kind of subtyping trick could do...
The text was updated successfully, but these errors were encountered:
This is a bit hard to explain, but my idea is to spark a discussion about how much graphql-api could benefit from using a proper Record library in some way (it's not clear how to me yet).
So I recently realized that, an object definition in a graphql-api schema is never inhabited with a value per-say. Like, we cannot create a value out of nowhere for it:
Of course we can create a resolver (that is a Handler in graphql-api) which can "sort of" create a graphql-api's Value's AST which will correspond to a "subtype" of Plant here.
Now this behavior is actually the very essence of graphql, so no problem. My point is, there should be a way to get back the fact that it's a Plant type, and a way to create an ad-hoc plant-type value. Probably the best way is to finalize the implementation of #192 . But I feel like this should be kept at the type level on haskell's side, and perhaps records or some kind of subtyping trick could do...
The text was updated successfully, but these errors were encountered: