Skip to content
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

Support deriving from module type declarations. #94

Merged
merged 1 commit into from
Apr 20, 2016

Conversation

paurkedal
Copy link
Contributor

I could use an extension of the deriving interface to allow deriving definitions from module types. The derived definitions would typically be a structure of the given signature or a functor producing or depending on it, though it could be regular functions involving first-class modules of the signature. My current use-case is to generate the RPC client and server parts for a Thrift service.

@paurkedal
Copy link
Contributor Author

paurkedal commented Apr 17, 2016

I noticed this breaks ppx_type_conv, since it registers Ppx_deriving with its own signature, see

It's documented as a private interface to be changed, so it may be a matter of synchronizing the releases.

@@ -19,10 +19,14 @@ type deriver = {
type_declaration list -> structure;
type_ext_str : options:(string * expression) list -> path:string list ->
type_extension -> structure;
modtype_str : options:(string * expression) list -> path:string list ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module_type_decl

@whitequark
Copy link
Collaborator

@diml How do we properly do releases in lockstep?

@ghost
Copy link

ghost commented Apr 18, 2016

I suppose instead of passing (module Ppx_deriving) I could expand all the functions, that will make the glue code more robust to small changes in ppx_deriving. I'll add this change to the next minor release batch I'll do this week

@whitequark
Copy link
Collaborator

Thanks!

@paurkedal
Copy link
Contributor Author

I pushed a version with modtype_* replaced by module_type_decl_*, I assume this is what you had in mind?

@whitequark
Copy link
Collaborator

Yep--thanks!

@whitequark whitequark merged commit 97afdf3 into ocaml-ppx:master Apr 20, 2016
@paurkedal paurkedal deleted the modtype branch April 21, 2016 16:48
@ghost
Copy link

ghost commented Apr 26, 2016

ppx_type_conv 113.33.03 has the change I described

@whitequark
Copy link
Collaborator

Ok--I will release a new ppx_deriving soon.

@paurkedal
Copy link
Contributor Author

Thanks to both of you! (Not quite ready for a release myself.)

ghost pushed a commit to janestreet-deprecated/ppx_type_conv that referenced this pull request Sep 6, 2016
Make the ppx_deriving glue more resilient to small changes in
ppx_deriving. Related to ocaml-ppx/ppx_deriving#94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants