Skip to content

Help on recursive types #120

@Lesenr1

Description

@Lesenr1

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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions