diff options
author | Son Ho | 2021-11-17 15:33:10 +0100 |
---|---|---|
committer | Son Ho | 2021-11-17 15:33:10 +0100 |
commit | 2903cd956575624313d29e1a3ecd1abcbaab4dc3 (patch) | |
tree | fd8b430643c60d188cab94447faad449933784f2 /src/Identifiers.ml | |
parent | 49b15dbc29deb712a551af321ce18ef8d3e446d0 (diff) |
Also generate to_yojson functions
Diffstat (limited to '')
-rw-r--r-- | src/Identifiers.ml | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Identifiers.ml b/src/Identifiers.ml index 51b6e473..27ed2921 100644 --- a/src/Identifiers.ml +++ b/src/Identifiers.ml @@ -19,11 +19,15 @@ module type Id = sig val id_of_yojson : Yojson.Safe.t -> (id, string) Result.result + val id_to_yojson : id -> Yojson.Safe.t + val vector_of_yojson : (Yojson.Safe.t -> ('a, string) Result.result) -> Yojson.Safe.t -> ('a vector, string) Result.result + val vector_to_yojson : ('a -> Yojson.Safe.t) -> 'a vector -> Yojson.Safe.t + (* TODO: remove *) (* module Map : Map.S with type key = id *) end @@ -34,9 +38,9 @@ end *) module IdGen () : Id = struct (* TODO: use Int64.t *) - type id = int [@@deriving of_yojson] + type id = int [@@deriving yojson] - type 'a vector = 'a list [@@deriving of_yojson] + type 'a vector = 'a list [@@deriving yojson] let zero = 0 @@ -73,6 +77,6 @@ module IdGen () : Id = struct module Map = Map.Make (ord) *) end -type name = string list [@@deriving of_yojson] +type name = string list [@@deriving yojson] (** A name such as: `std::collections::vector` (which would be represented as [["std"; "collections"; "vector"]]) *) |