Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
The minimum interface for libraries and applications to work together.
If you are the author of a library that uses asai, it is recommended to wrap your reporter with this signature in the wrapper. For example, if you are using Dune, and your wrapper file is CoolLibrary.ml(i)
, use this to wrap your Reporter
:
module Reporter : Asai.MinimumSigs.Reporter
If you arrive here because the library you are using employs this template signature to reveal only the minimum API, you can write the following code to connect the library's reporter to yours:
Reporter.adopt (Diagnostic.map message_mapper) CoolLibrary.Reporter.run @@ fun () -> ...
Please take a look at our Quick Start Tutorial about how to use a library that uses asai.
val run :
?init_loc:Range.t ->
?init_backtrace:Diagnostic.backtrace ->
emit:(Message.t Diagnostic.t -> unit) ->
fatal:(Message.t 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 () -> ...