Skip to content

Commit

Permalink
Merge pull request #159 from NathanReb/expose-derivers
Browse files Browse the repository at this point in the history
Expose Deriving.t to allow definition of external Deriving aliases
  • Loading branch information
NathanReb authored Jul 25, 2024
2 parents 61f2d63 + b7ea5fb commit f2e79bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
unreleased
----------

* Expose Deriving.t values to allow definition of external Deriving aliases
(#159)
@NathanReb

3.8.0
-----

Expand Down
6 changes: 3 additions & 3 deletions src/ppx_deriving_yojson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ let make_gen f =
in
Deriving.Generator.V2.make (args ()) f'

let _to_deriving: Deriving.t =
let to_yojson: Deriving.t =
Deriving.add
"to_yojson"
~str_type_decl:(make_gen (fun ~options ~path (_, type_decls) ->
Expand All @@ -931,7 +931,7 @@ let _to_deriving: Deriving.t =
~str_type_ext:(make_gen ser_str_of_type_ext)
~sig_type_ext:(make_gen ser_sig_of_type_ext)

let _of_deriving: Deriving.t =
let of_yojson: Deriving.t =
Deriving.add
"of_yojson"
~str_type_decl:(make_gen (fun ~options ~path (_, type_decls) ->
Expand All @@ -944,7 +944,7 @@ let _of_deriving: Deriving.t =
~sig_type_ext:(make_gen desu_sig_of_type_ext)

(* Not just alias because yojson also has meta (without its own deriver name) *)
let _deriving: Deriving.t =
let yojson: Deriving.t =
Deriving.add
"yojson"
~str_type_decl:(make_gen (fun ~options ~path (_, type_decls) ->
Expand Down
5 changes: 5 additions & 0 deletions src/ppx_deriving_yojson.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
val to_yojson : Ppxlib.Deriving.t

val of_yojson : Ppxlib.Deriving.t

val yojson : Ppxlib.Deriving.t

0 comments on commit f2e79bb

Please sign in to comment.