Skip to content

Commit

Permalink
feat: have error implement typereg
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jul 19, 2024
1 parent 17ee531 commit 571b923
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/error/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(public_name imandrakit.error)
(name imandrakit_error)
(preprocess
(pps ppx_deriving.std imandrakit.twine.ppx))
(pps ppx_deriving.std imandrakit.twine.ppx imandrakit.typereg.ppx))
(flags :standard -open Imandrakit_common)
(synopsis "Error library for imandrakit")
(libraries imandrakit.common imandrakit.twine hmap logs containers))
6 changes: 3 additions & 3 deletions src/error/error_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ type message = {
data: Data.t;
bt: string option; [@key "bt"]
}
[@@deriving twine]
[@@deriving twine, typereg]

type stack = message list [@@deriving twine]
type stack = message list [@@deriving twine, typereg]

type t = {
process: string; [@key "p"]
kind: Kind.t; [@key "k"]
msg: message; [@key "msg"]
stack: stack; [@key "st"]
}
[@@deriving twine]
[@@deriving twine, typereg]

exception E of t

Expand Down
2 changes: 1 addition & 1 deletion src/error/kind.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Twine = Imandrakit_twine

type t = { name: string } [@@unboxed] [@@deriving show, ord, eq]
type t = { name: string } [@@unboxed] [@@deriving show, ord, eq, typereg]

let[@inline] hash self = CCHash.string self.name
let make ~name () : t = { name }
Expand Down
4 changes: 2 additions & 2 deletions src/typereg/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
(synopsis "Type registry")
(preprocess
(pps ppx_deriving.std ppx_deriving_yojson))
(flags :standard -open Imandrakit)
(libraries imandrakit iter))
(flags :standard)
(libraries containers iter))
4 changes: 3 additions & 1 deletion src/typereg/imandrakit_typereg.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module Tbl = Str_tbl
module Tbl = CCHashtbl.Make (CCString)
module Ty_expr = Ty_expr
module Ty_def = Ty_def

let spf = Printf.sprintf

type t = {
tbl: (Ty_def.t * Ty_def.clique) Tbl.t;
mutable cliques: Ty_def.clique list;
Expand Down

0 comments on commit 571b923

Please sign in to comment.