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
First just a few words of mention to thank everyone for their work on this library. Even at this somewhat early stage of development, the library has proved useful and productive - I can't imagine hydrating our App's React-based UI any other way! Also, congratulations to everyone for being added to the "State of the Haskell Ecosystem" maintained by Gabriel Gonzalez among other leading contributors in the Haskell community.
To the question: There is a Haskell norm using the Lens library to name the record fields with a prefix underscore (e.g., _myField). When the library derives the required Lens instances it will then name the lenses without the prefix (my lens for that field is automagically referenced as myField). Nice.
In the graphql-api we can derive FromValue and HasAnnotatedInputType instances for our Haskell data record types we intend to use as GraphQL ObjectInputType. The library has taken on the same convention. However, there are two ways/places to reference the user input where the benefit of opting-in to the convention is different:
Referencing the fields in a GraphQL resolver (like what is done in the example for ObjectInput; lines 31-34)
Referencing the fields in Haskell e.g., to instantiate a Haskell type, or otherwise mutate the Haskell state (non-GraphQL division of the App if you will). In this case, the returned output from GraphQL (the "view") might be a GraphQL view (Object type) of a different type, i.e., not the ObjectInputType.
In the first case, I can see the benefit of using the lower case prefix. In the second, I don't other than to avoid name clashes, but that's not the main point.
The question: As a user (not the library designer), what is the downside of not using the underscore prefix if I'm in the second use case scenario? Also, what names does the Generic derived instance generate when not using the underscore prefix convention?
Thank you again for your input. I hope some of these questions serve a broader audience, and might provide fodder for the next generation of documentation.
- E
The text was updated successfully, but these errors were encountered:
First just a few words of mention to thank everyone for their work on this library. Even at this somewhat early stage of development, the library has proved useful and productive - I can't imagine hydrating our App's React-based UI any other way! Also, congratulations to everyone for being added to the "State of the Haskell Ecosystem" maintained by Gabriel Gonzalez among other leading contributors in the Haskell community.
To the question: There is a Haskell norm using the
Lens
library to name the record fields with a prefix underscore (e.g.,_myField
). When the library derives the requiredLens
instances it will then name the lenses without the prefix (my lens for that field is automagically referenced asmyField
). Nice.In the
graphql-api
we can deriveFromValue
andHasAnnotatedInputType
instances for our Haskell data record types we intend to use as GraphQLObjectInputType
. The library has taken on the same convention. However, there are two ways/places to reference the user input where the benefit of opting-in to the convention is different:ObjectInputType
.In the first case, I can see the benefit of using the lower case prefix. In the second, I don't other than to avoid name clashes, but that's not the main point.
The question: As a user (not the library designer), what is the downside of not using the underscore prefix if I'm in the second use case scenario? Also, what names does the
Generic
derived instance generate when not using the underscore prefix convention?Thank you again for your input. I hope some of these questions serve a broader audience, and might provide fodder for the next generation of documentation.
- E
The text was updated successfully, but these errors were encountered: