-
Notifications
You must be signed in to change notification settings - Fork 109
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
Using protoc cli parameter to specify additional class derivations #429
base: master
Are you sure you want to change the base?
Conversation
…e additional stock deriving
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
This is quite small pull request, maybe I could receive some human feedback before google-cla bot approval. If changes could be merged in principle (maybe after some improvements) - then I'll sign cla. Otherwise it does not make much sense. |
Thanks for the PR. It looks like a useful capability. I pointed out some areas for improvement. In addition to those, please add a test covering this newly added functionality. |
The main feature of this PR is support of additional class instances for all generated types. Parameters for additional class deriving could be passed through
protoc
command-line argument. Example which enables stock deriving ofGHC.Generics.Generic
class for all generated haskell types:--haskell_opt='Opt{ imports = [], pragmas = ["DeriveGeneric"], stockInstances = ["GHC.Generics.Generic"], defaultInstances = [] }'
Data.ProtoLens.Compiler.Parameter
module which enables usage of cliparameter
fromplugin.proto
.Data.ProtoLens.Compiler.Parameter
to enable additional stock deriving (useful for classes likeGHC.Generics.Generic
).Data.ProtoLens.Compiler.Parameter
to enable additional default instances implementations (useful for classes which do support default implementations throughGHC.Generics.Generic
).