Add ability to set ShortName at Type#84
Merged
Gabriella439 merged 1 commit intoGabriella439:masterfrom Aug 30, 2021
Merged
Conversation
Owner
|
Yeah, I'm worried about |
d7646a9 to
b1846b7
Compare
Contributor
Author
|
Okay, I changed |
Owner
|
Looks great! Thank you for contributing this 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In #36, the ability to set a short name was added via
Modifiers. In #41, there is a request to make sure these short names are unique. This PR attempts to enhance short-name creation with a type decorator; while it does not prevent duplicate short names, it makes dealing with them much easier.This PR adds a new decorator
<$>("$" signaling "S", which stands for "Short name", although it can certainly be changed if the connection tofmapis too strong) that allows the short name of a field to be specified in its type. This short name supersedes any that is set byModifiers; this way, one can use a standard short-name modifier (say,firstLetter), and then manually replace short names of specific fields in the type. Adding<$> ""to a type removes the short name altogether.Unfortunately, there are no type-level
Chars, which means that we're forced to use type-level strings (i.e.,Symbol); in this implementation, I opt to ignore all but the first character.