Skip to content

Commit 8367ab3

Browse files
committed
Add Eval.pp_error_kind function
1 parent 0f2547b commit 8367ab3

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/smtml/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
(backend bisect_ppx --exclusions src/smtml/bisect.exclude)
112112
(deps bisect.exclude))
113113
(preprocess
114-
(pps ppx_deriving.std)))
114+
(pps ppx_deriving.std ppx_deriving.show)))
115115

116116
(rule
117117
(targets

src/smtml/eval.ml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@ type op_type =
1515
| `Cvtop of Ty.Cvtop.t
1616
| `Naryop of Ty.Naryop.t
1717
]
18-
19-
let pp_op_type fmt = function
20-
| `Unop op -> Fmt.pf fmt "unop '%a'" Ty.Unop.pp op
21-
| `Binop op -> Fmt.pf fmt "binop '%a'" Ty.Binop.pp op
22-
| `Relop op -> Fmt.pf fmt "relop '%a'" Ty.Relop.pp op
23-
| `Triop op -> Fmt.pf fmt "triop '%a'" Ty.Triop.pp op
24-
| `Cvtop op -> Fmt.pf fmt "cvtop '%a'" Ty.Cvtop.pp op
25-
| `Naryop op -> Fmt.pf fmt "naryop '%a'" Ty.Naryop.pp op
18+
[@@deriving show]
2619

2720
type type_error_info =
2821
{ index : int
@@ -31,6 +24,7 @@ type type_error_info =
3124
; op : op_type
3225
; msg : string
3326
}
27+
[@@deriving show]
3428

3529
type error_kind =
3630
[ `Divide_by_zero
@@ -42,6 +36,7 @@ type error_kind =
4236
| `Unsupported_theory of Ty.t
4337
| `Type_error of type_error_info
4438
]
39+
[@@deriving show]
4540

4641
exception Eval_error of error_kind
4742

src/smtml/eval.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ type error_kind =
4242
| `Type_error of type_error_info
4343
]
4444

45+
val pp_error_kind : error_kind Fmt.t
46+
4547
(** Exception raised when an error occurs during concrete evaluation. *)
4648
exception Eval_error of error_kind
4749

0 commit comments

Comments
 (0)