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

Use Dyn.result for result types #5

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deriver/ppx_deriving_dyn.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Impl = struct
| Lident ("bool" as s)
| Lident ("list" as s)
| Lident ("array" as s)
| Lident ("result" as s)
| Lident ("option" as s) ->
Ast_builder.Default.pexp_ident ~loc { txt = Ldot (Lident "Dyn", s); loc }
| Lident s -> Ast_builder.Default.evar ~loc (to_dyn_name s)
Expand Down
6 changes: 6 additions & 0 deletions test/deriver/test_to_dyn.expected.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ module Base_types =
type 'a t11 = 'a option[@@deriving dyn]
include struct let t11_to_dyn a_to_dyn t11 = Dyn.option a_to_dyn t11 end
[@@ocaml.doc "@inline"][@@merlin.hide ]
type ('a, 'b) t12 = ('a, 'b) result[@@deriving dyn]
include
struct
let t12_to_dyn a_to_dyn b_to_dyn t12 =
Dyn.result a_to_dyn b_to_dyn t12
end[@@ocaml.doc "@inline"][@@merlin.hide ]
end
module To_dyn_attr =
struct
Expand Down
1 change: 1 addition & 0 deletions test/deriver/test_to_dyn.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module Base_types = struct
type 'a t9 = 'a list [@@deriving dyn]
type 'a t10 = 'a array [@@deriving dyn]
type 'a t11 = 'a option [@@deriving dyn]
type ('a, 'b) t12 = ('a, 'b) result [@@deriving dyn]
end

module To_dyn_attr = struct
Expand Down