google / proto-lens

API for protocol buffers using modern Haskell language and library patterns.
https://google.github.io/proto-lens
BSD 3-Clause "New" or "Revised" License
460 stars 110 forks source link

Using protoc cli parameter to specify additional class derivations #429

Open tim2CF opened 2 years ago

tim2CF commented 2 years ago

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 of GHC.Generics.Generic class for all generated haskell types:

--haskell_opt='Opt{ imports = [], pragmas = ["DeriveGeneric"], stockInstances = ["GHC.Generics.Generic"], defaultInstances = [] }'
google-cla[bot] commented 2 years ago

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).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

tim2CF commented 2 years ago

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.

blackgnezdo commented 2 years ago

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.