module type S =sig..end
type'aresult =('a, exn) Result.t
Represent either a result of type 'a or an error with an exception.
exception Typing_error of Options.category option * string
Typing error where the first element is the phase where the error occured and the second element is the error message.
exception Not_yet of Options.category option * string
"Not yet supported" error where the first element is the phase where the error occured and the second element is the error message.
exception Not_memoized of Options.category option
"Not memoized" error with the phase where the error occured.
val make_untypable : string -> exnMake a Typing_error exception with the given message.
val make_not_yet : string -> exnMake a Not_yet exception with the given message.
val make_not_memoized : unit -> exnMake a Not_memoized exception with the given message.
val untypable : string -> 'aTyping_error with the given message for the current phase.val not_yet : string -> 'aNot_yet with the given message for the current phase.val not_memoized : unit -> 'aNot_memoized for the current phase.val print_not_yet : string -> unitPrint the "not yet supported" message without raising an exception.
val handle : ('a -> 'a) -> 'a -> 'aRun the closure with the given argument and handle potential errors. Return the provide argument in case of errors.
val generic_handle : ('a -> 'b) -> 'b -> 'a -> 'bRun the closure with the given argument and handle potential errors. Return the additional argument in case of errors.
val retrieve_preprocessing : string ->
('a -> 'b result) ->
'a -> (Stdlib.Format.formatter -> 'a -> unit) -> 'bRetrieve the result of a preprocessing phase, which possibly failed.
The string argument and the formatter are used to display a message in
case the preprocessing phase did not compute the required result.
val pp_result : (Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter -> 'a result -> unitpp_result pp where pp is a formatter for 'a returns a formatter for
'a result.