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

Extend deriving API to work on modules #546

Open
benbellick opened this issue Dec 17, 2024 · 1 comment
Open

Extend deriving API to work on modules #546

benbellick opened this issue Dec 17, 2024 · 1 comment

Comments

@benbellick
Copy link

Hey @NathanReb. Thanks again for the awesome work here.
In light of this comment, I wanted to see if it is possible after all (and not too difficult) to extend the deriving API to operate on modules, rather than only module types.

FYI, if you're curious to see the repo where I am hoping to use this, it is here.

As I mentioned in the prior conversation, I would love to be able to do the following:

module X = struct 
  type t = int * string 
end [@@deriving decoders]

--via-ppx-->

module X = struct 
  type t = int * string 
  module Encode (D : Decoders.Decode.S) = struct 
    let t_decode = <SOME IMPLE USING D>
  end 
end

Please let me know if this is possible and if there is time for it! Happy to help also if there is an easy way to jump into the codebase.

@patricoferris
Copy link
Collaborator

@benbellick this seems very reasonable to me. I don't think @NathanReb and I currently have the bandwidth for this, but an implementation is going to look very similar to #538 only instead of class type declarations you will want module implementations -- following that PR might be the easiest way to jump in.

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

No branches or pull requests

2 participants