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

Help on recursive types #120

Open
Lesenr1 opened this issue May 20, 2020 · 0 comments
Open

Help on recursive types #120

Lesenr1 opened this issue May 20, 2020 · 0 comments

Comments

@Lesenr1
Copy link

Lesenr1 commented May 20, 2020

Hi!
I have a bunch of recursive types, one of which is using the Map fonctor.
I tried to follow the example and wrote this:

module TMap = Map.Make( struct type t = string let compare = compare end)
type 'a tmap = 'a TMap.t

type mytmap = t_content tmap [@to_yojson (fun m -> TMap.bindings m |> [%to_yojson: (string * t_content) list])]
and t_content = {
  t1 : t1;
  t2 : t2;
}
and t1 = string
and t2 =
  | Foo of t2
  | Bar of mytmap
[@@deriving yojson]

When compiling, OCaml gives me Error: Uninterpreted extension 'to_yojson'.

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

1 participant