Add ability to set ShortName at Type #84
Merged
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 tofmap
is 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
Char
s, 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.