You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Partially addresses #7560
Coq exception handling is complex, and requires quite a bit of
meta-data on exceptions, including custom printing and documentation
for each error.
We introduce an error registration API that should help with the above
problematic, by requiring new errors to be properly registered.
There are some questions:
- OCaml has support for private extensible types, however that cannot
be used with exceptions unless we introduce a `CErrors.t` type. May
be worth doing.
- We could make the error kinds extensible too, but I'm not sure it is
worth the gain, and it could be used badly.
- Is the E0 variant worth it?
A new error is declared as:
```ocaml
module UE_Sig = struct
type t = string option * Pp.t
let print (hdr, pp) = Pp.strpp
let doc = Pp.str "Generic User Error, to be deprecated"
let kind = ErrorKind.Regular
end
module UserError = CoqError.Make(UE_Sig)
```
in the `.mli` file:
```ocaml
module UserError = CErrors.S with type t := string option * Pp.t
```
the `with type` constraint is needed if the user wishes to expose the
exception constructor.
0 commit comments