-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring name generating functions in TH #1218
Merged
Merged
Conversation
This file contains 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
parsonsmatt
approved these changes
Apr 19, 2021
this is great, thanks! 😄 i'm going to make a 2.12.1.1 patch release soon, do you want to add a note in the changelog for this? |
5 tasks
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.
Before submitting your PR, check that you've:
@since
declarations to the HaddockAfter submitting your PR:
(unreleased)
on the ChangelogRefactors the
TH
module, specifically themed around generatingTH
Name
s, orExp
values that use those names.Now I think this module is a lot dry'er, where we have some duplication currently scattered around this module dealing with how names are generated.
For example, the Entity name when using
mpsGeneric
was duplicated in 3 different places, this change has DRY'd this up into a single function.I considered moving these functions out and into their own module, and adding some HSpec tests for each name generating function, for the key name generating functions at least, such as the constructor name/field accessor names, but thought this might be over kill. I think this functionality is largely covered in
persistent-test
so thought best of doing that. I have grouped these functions at the bottom of the module anyway.I think there is probably more we can do here to make this module a bit easier to follow in line with #1156 while also trying to balance out not changing too much in a single change request. Hopefully there are some values/functions in here now with some slightly clearer names too.
I took a very incremental approach to this change, so there are a lot of commits here. I've left them as they are for now, but if it is preferred that they're squashed into a single commit I can do so 👍