Guide type inference for Record type class instances via newtypes, not Proxies #302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the change
While working on purescript-json-codecs, I realized that all these proxy args used to guide type inference could be replaced with newtypes now that we have polykinds and explicit kind signatures. Doing so removes one or two curried functions from the resulting code at the cost of some readability.
Naming used was the first letter of the type class name (e.g.
SforSemigroup) followed byRecord. If two newtypes were needed, then1or2was thrown in there somewhere.Throughout this code, I only really use 2-3 newtypes. I wonder if these newtypes should actually be defined somewhere so one can reuse them to implement Record instances for various type classes.
Regardless, if this is accepted, I think the newtypes' names should be changed to prevent users from accidentally importing them since they really are intended to be internal. Perhaps something like
__SRecord1?Checklist: