Module Syslib.Reporter

The module for messages.

val run : ?init_loc:Asai.Range.t -> ?init_backtrace:Asai.Diagnostic.backtrace -> emit:(Message.t Asai.Diagnostic.t -> unit) -> fatal:(Message.t Asai.Diagnostic.t -> 'a) -> (unit -> 'a) -> 'a

run ~emit ~fatal f runs the thunk f, using emit to handle non-fatal diagnostics before continuing the computation, and fatal to handle fatal diagnostics that have aborted the computation. The recommended way to handle messages from a library that uses asai is to use adopt:

Reporter.adopt (Diagnostic.map message_mapper) The_library.Reporter.run @@ fun () -> ...
  • parameter init_loc

    The initial default location for messages.

  • parameter init_backtrace

    The initial backtrace to start with. The default value is the empty backtrace.

  • parameter emit

    The handler of non-fatal diagnostics.

  • parameter fatal

    The handler of fatal diagnostics.