From 18f41ec7526d4b0a9c0bd76b4a2a8073b10f85c9 Mon Sep 17 00:00:00 2001 From: favonia Date: Sat, 28 Oct 2023 21:07:44 +0000 Subject: [PATCH] deploy: bbd7d0b747712ee54986747b136405820926cf9d --- asai/Asai/Reporter/Make/index.html | 22 +++++++++---------- asai/Asai/Reporter/module-type-S/index.html | 22 +++++++++---------- asai/Asai/StructuredReporter/Make/index.html | 12 +++++----- .../module-type-S/index.html | 12 +++++----- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/asai/Asai/Reporter/Make/index.html b/asai/Asai/Reporter/Make/index.html index f636106..42a42be 100644 --- a/asai/Asai/Reporter/Make/index.html +++ b/asai/Asai/Reporter/Make/index.html @@ -6,46 +6,46 @@ ?extra_remarks:Diagnostic.loctext list -> Message.t -> string -> - unit

emit message explanation emits the explanation and continues the computation.

Example:

Reporter.emit TypeError "the type `nat' is extremely unnatural"
val emitf : + unit

emit message explanation emits the explanation and continues the computation.

Example:

Reporter.emit TypeError "the type `nat' is extremely unnatural"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emitf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> - 'a

emitf message format ... formats and emits a message, and then continues the computation. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.emitf TypeError "type %a is too ugly" Syntax.pp tp
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : + 'a

emitf message format ... formats and emits a message, and then continues the computation. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.emitf TypeError "type %a is too ugly" Syntax.pp tp
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> string -> - 'a

fatal message explanation aborts the current computation with the explanation.

Example:

Reporter.fatal CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatalf : + 'a

fatal message explanation aborts the current computation with the explanation.

Example:

Reporter.fatal CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatalf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> - 'a

fatalf message format ... constructs a diagnostic and aborts the current computation with the diagnostic. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.fatalf SecurityTooStrict "failed to write the password %s on the screen" password
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
-with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val tracef : + 'a

fatalf message format ... constructs a diagnostic and aborts the current computation with the diagnostic. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.fatalf SecurityTooStrict "failed to write the password %s on the screen" password
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
+with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val tracef : ?loc:Range.t -> ('a, Stdlib.Format.formatter, unit, (unit -> 'b) -> 'b) Stdlib.format4 -> - 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current location.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the initial location loc. Note that with_loc None will clear the current location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current location and runs the thunk f. By "merge", it means that if loc is None, then the current location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : + 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace. Note that a non-None location given here will become the new default location for inner emit and fatal.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current default location for emit and fatal.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the new default location for emit and fatal. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current default location for emit and fatal and runs the thunk f. By "merge", it means that if loc is None, then the current default location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> string -> - Message.t Diagnostic.t

diagnostic message explanation constructs a diagnostic with the explanation along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val diagnosticf : + Message.t Diagnostic.t

diagnostic message explanation constructs a diagnostic with the explanation along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val diagnosticf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> ('a, Stdlib.Format.formatter, unit, Message.t Diagnostic.t) Stdlib.format4 -> - 'a

diagnosticf message format ... constructs a diagnostic along with the backtrace frames recorded via trace. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.diagnosticf TypeError "term %a does not type check, maybe" Syntax.pp tm
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val kdiagnosticf : + 'a

diagnosticf message format ... constructs a diagnostic along with the backtrace frames recorded via trace. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.diagnosticf TypeError "term %a does not type check, maybe" Syntax.pp tm
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val kdiagnosticf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> @@ -53,13 +53,13 @@ (Message.t Diagnostic.t -> 'b) -> Message.t -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> - 'a

kdiagnosticf kont message format ... is kont (diagnosticf message format ...). Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

val run : + 'a

kdiagnosticf kont message format ... is kont (diagnosticf message format ...). Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

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 (see emit and emitf), and fatal to handle fatal diagnostics that have aborted the computation (see fatal and fatalf).

  • 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.

val adopt : + 'a

run ~emit ~fatal f runs the thunk f, using emit to handle non-fatal diagnostics before continuing the computation (see emit), and fatal to handle fatal diagnostics that have aborted the computation (see fatal).

  • parameter init_loc

    The initial default location for inner emit and fatal. The default value is None.

  • 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.

val adopt : ('message Diagnostic.t -> Message.t Diagnostic.t) -> (?init_loc:Range.t -> ?init_backtrace:Diagnostic.backtrace -> @@ -80,7 +80,7 @@ ?emit:(Message.t Diagnostic.t -> unit) -> ?fatal:(Message.t Diagnostic.t -> 'a) -> (unit -> 'a) -> - 'a

try_with ~emit ~fatal f runs the thunk f, using emit to intercept non-fatal diagnostics before continuing the computation (see emit and emitf), and fatal to intercept fatal diagnostics that have aborted the computation (see fatal and fatalf). The default interceptors re-emit or re-raise the intercepted diagnostics.

  • parameter emit

    The interceptor of non-fatal diagnostics. The default value is emit_diagnostic.

  • parameter fatal

    The interceptor of fatal diagnostics. The default value is fatal_diagnostic.

val map_diagnostic : + 'a

try_with ~emit ~fatal f runs the thunk f, using emit to intercept non-fatal diagnostics before continuing the computation (see emit), and fatal to intercept fatal diagnostics that have aborted the computation (see fatal). The default interceptors re-emit or re-raise the intercepted diagnostics.

  • parameter emit

    The interceptor of non-fatal diagnostics. The default value is emit_diagnostic.

  • parameter fatal

    The interceptor of fatal diagnostics. The default value is fatal_diagnostic.

val map_diagnostic : (Message.t Diagnostic.t -> Message.t Diagnostic.t) -> (unit -> 'a) -> 'a

map_diagnostic m f runs the thunk f and applies m to any diagnostic sent by f. It is a convenience function that can be implemented as follows:

let map_diagnostic m f =
diff --git a/asai/Asai/Reporter/module-type-S/index.html b/asai/Asai/Reporter/module-type-S/index.html
index e3ddf17..66c257b 100644
--- a/asai/Asai/Reporter/module-type-S/index.html
+++ b/asai/Asai/Reporter/module-type-S/index.html
@@ -6,46 +6,46 @@
   ?extra_remarks:Diagnostic.loctext list ->
   Message.t ->
   string ->
-  unit

emit message explanation emits the explanation and continues the computation.

Example:

Reporter.emit TypeError "the type `nat' is extremely unnatural"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emitf : + unit

emit message explanation emits the explanation and continues the computation.

Example:

Reporter.emit TypeError "the type `nat' is extremely unnatural"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emitf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> - 'a

emitf message format ... formats and emits a message, and then continues the computation. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.emitf TypeError "type %a is too ugly" Syntax.pp tp
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : + 'a

emitf message format ... formats and emits a message, and then continues the computation. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.emitf TypeError "type %a is too ugly" Syntax.pp tp
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> string -> - 'a

fatal message explanation aborts the current computation with the explanation.

Example:

Reporter.fatal CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatalf : + 'a

fatal message explanation aborts the current computation with the explanation.

Example:

Reporter.fatal CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatalf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> - 'a

fatalf message format ... constructs a diagnostic and aborts the current computation with the diagnostic. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.fatalf SecurityTooStrict "failed to write the password %s on the screen" password
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
-with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val tracef : + 'a

fatalf message format ... constructs a diagnostic and aborts the current computation with the diagnostic. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.fatalf SecurityTooStrict "failed to write the password %s on the screen" password
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
+with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val tracef : ?loc:Range.t -> ('a, Stdlib.Format.formatter, unit, (unit -> 'b) -> 'b) Stdlib.format4 -> - 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current location.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the initial location loc. Note that with_loc None will clear the current location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current location and runs the thunk f. By "merge", it means that if loc is None, then the current location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : + 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace. Note that a non-None location given here will become the new default location for inner emit and fatal.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current default location for emit and fatal.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the new default location for emit and fatal. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current default location for emit and fatal and runs the thunk f. By "merge", it means that if loc is None, then the current default location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> string -> - Message.t Diagnostic.t

diagnostic message explanation constructs a diagnostic with the explanation along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val diagnosticf : + Message.t Diagnostic.t

diagnostic message explanation constructs a diagnostic with the explanation along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val diagnosticf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> ('a, Stdlib.Format.formatter, unit, Message.t Diagnostic.t) Stdlib.format4 -> - 'a

diagnosticf message format ... constructs a diagnostic along with the backtrace frames recorded via trace. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.diagnosticf TypeError "term %a does not type check, maybe" Syntax.pp tm
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val kdiagnosticf : + 'a

diagnosticf message format ... constructs a diagnostic along with the backtrace frames recorded via trace. Note that there should not be any literal control characters. See Diagnostic.text.

Example:

Reporter.diagnosticf TypeError "term %a does not type check, maybe" Syntax.pp tm
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val kdiagnosticf : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?backtrace:Diagnostic.backtrace -> @@ -53,13 +53,13 @@ (Message.t Diagnostic.t -> 'b) -> Message.t -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> - 'a

kdiagnosticf kont message format ... is kont (diagnosticf message format ...). Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

val run : + 'a

kdiagnosticf kont message format ... is kont (diagnosticf message format ...). Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

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 (see emit and emitf), and fatal to handle fatal diagnostics that have aborted the computation (see fatal and fatalf).

  • 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.

val adopt : + 'a

run ~emit ~fatal f runs the thunk f, using emit to handle non-fatal diagnostics before continuing the computation (see emit), and fatal to handle fatal diagnostics that have aborted the computation (see fatal).

  • parameter init_loc

    The initial default location for inner emit and fatal. The default value is None.

  • 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.

val adopt : ('message Diagnostic.t -> Message.t Diagnostic.t) -> (?init_loc:Range.t -> ?init_backtrace:Diagnostic.backtrace -> @@ -80,7 +80,7 @@ ?emit:(Message.t Diagnostic.t -> unit) -> ?fatal:(Message.t Diagnostic.t -> 'a) -> (unit -> 'a) -> - 'a

try_with ~emit ~fatal f runs the thunk f, using emit to intercept non-fatal diagnostics before continuing the computation (see emit and emitf), and fatal to intercept fatal diagnostics that have aborted the computation (see fatal and fatalf). The default interceptors re-emit or re-raise the intercepted diagnostics.

  • parameter emit

    The interceptor of non-fatal diagnostics. The default value is emit_diagnostic.

  • parameter fatal

    The interceptor of fatal diagnostics. The default value is fatal_diagnostic.

val map_diagnostic : + 'a

try_with ~emit ~fatal f runs the thunk f, using emit to intercept non-fatal diagnostics before continuing the computation (see emit), and fatal to intercept fatal diagnostics that have aborted the computation (see fatal). The default interceptors re-emit or re-raise the intercepted diagnostics.

  • parameter emit

    The interceptor of non-fatal diagnostics. The default value is emit_diagnostic.

  • parameter fatal

    The interceptor of fatal diagnostics. The default value is fatal_diagnostic.

val map_diagnostic : (Message.t Diagnostic.t -> Message.t Diagnostic.t) -> (unit -> 'a) -> 'a

map_diagnostic m f runs the thunk f and applies m to any diagnostic sent by f. It is a convenience function that can be implemented as follows:

let map_diagnostic m f =
diff --git a/asai/Asai/StructuredReporter/Make/index.html b/asai/Asai/StructuredReporter/Make/index.html
index 7a86263..2862b92 100644
--- a/asai/Asai/StructuredReporter/Make/index.html
+++ b/asai/Asai/StructuredReporter/Make/index.html
@@ -6,31 +6,31 @@
   ?backtrace:Diagnostic.backtrace ->
   ?extra_remarks:Diagnostic.loctext list ->
   Message.t ->
-  unit

emit message emits the message and continues the computation.

Example:

Reporter.emit @@ TypeError (tm, ty)
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter text

    The text (to overwrite the default text inferred from the message msg).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : + unit

emit message emits the message and continues the computation.

Example:

Reporter.emit @@ TypeError (tm, ty)
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter text

    The text (to overwrite the default text inferred from the message msg).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?text:Diagnostic.text -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> - 'a

fatal message aborts the current computation with the message.

Example:

Reporter.fatal @@ CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
-with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val tracef : + 'a

fatal message aborts the current computation with the message.

Example:

Reporter.fatal @@ CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
+with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val tracef : ?loc:Range.t -> ('a, Stdlib.Format.formatter, unit, (unit -> 'b) -> 'b) Stdlib.format4 -> - 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current location.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the initial location loc. Note that with_loc None will clear the current location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current location and runs the thunk f. By "merge", it means that if loc is None, then the current location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : + 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace. Note that a non-None location given here will become the new default location for inner emit and fatal.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current default location for emit and fatal.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the new default location for emit and fatal. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current default location for emit and fatal and runs the thunk f. By "merge", it means that if loc is None, then the current default location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?text:Diagnostic.text -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> - Message.t Diagnostic.t

diagnostic message constructs a diagnostic with the message along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic @@ SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

diagnostic message constructs a diagnostic with the message along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic @@ SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

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 (see emit), and fatal to handle fatal diagnostics that have aborted the computation (see fatal).

  • 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.

val adopt : + 'a

run ~emit ~fatal f runs the thunk f, using emit to handle non-fatal diagnostics before continuing the computation (see emit), and fatal to handle fatal diagnostics that have aborted the computation (see fatal).

  • parameter init_loc

    The initial default location for inner emit and fatal. The default value is None.

  • 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.

val adopt : ('message Diagnostic.t -> Message.t Diagnostic.t) -> (?init_loc:Range.t -> ?init_backtrace:Diagnostic.backtrace -> diff --git a/asai/Asai/StructuredReporter/module-type-S/index.html b/asai/Asai/StructuredReporter/module-type-S/index.html index 90169d7..a8acfcb 100644 --- a/asai/Asai/StructuredReporter/module-type-S/index.html +++ b/asai/Asai/StructuredReporter/module-type-S/index.html @@ -6,31 +6,31 @@ ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> - unit

emit message emits the message and continues the computation.

Example:

Reporter.emit @@ TypeError (tm, ty)
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter text

    The text (to overwrite the default text inferred from the message msg).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : + unit

emit message emits the message and continues the computation.

Example:

Reporter.emit @@ TypeError (tm, ty)
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter text

    The text (to overwrite the default text inferred from the message msg).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val emit_diagnostic : Message.t Diagnostic.t -> unit

Emit a diagnostic and continue the computation.

val fatal : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?text:Diagnostic.text -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> - 'a

fatal message aborts the current computation with the message.

Example:

Reporter.fatal @@ CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
-with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val tracef : + 'a

fatal message aborts the current computation with the message.

Example:

Reporter.fatal @@ CatError "forgot to feed the cat"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

val fatal_diagnostic : Message.t Diagnostic.t -> 'a

Abort the computation with a diagnostic.

Backtraces

val get_backtrace : unit -> Diagnostic.backtrace

get_backtrace() returns the current backtrace.

val with_backtrace : Diagnostic.backtrace -> (unit -> 'a) -> 'a

with_backtrace bt f runs the thunk f with bt as the initial backtrace.

Example:

(* running code with a fresh backtrace *)
+with_backtrace Emp @@ fun () -> ...
val trace : ?loc:Range.t -> string -> (unit -> 'a) -> 'a

trace str f records the string str and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val tracef : ?loc:Range.t -> ('a, Stdlib.Format.formatter, unit, (unit -> 'b) -> 'b) Stdlib.format4 -> - 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current location.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the initial location loc. Note that with_loc None will clear the current location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current location and runs the thunk f. By "merge", it means that if loc is None, then the current location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : + 'a

tracef format ... f formats and records a frame in the backtrace, and runs the thunk f with the new backtrace. Note that there should not be any literal control characters. See Diagnostic.text.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_text : ?loc:Range.t -> Diagnostic.text -> (unit -> 'a) -> 'a

trace_text text f records the text and runs the thunk f with the new backtrace.

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is None. Note that a non-None location given here will become the new default location for inner emit and fatal.

val trace_loctext : Diagnostic.loctext -> (unit -> 'a) -> 'a

trace_loctext loctext f records the loctext and runs the thunk f with the new backtrace. Note that a non-None location given here will become the new default location for inner emit and fatal.

Locations

val get_loc : unit -> Range.t option

get_loc() returns the current default location for emit and fatal.

val with_loc : Range.t option -> (unit -> 'a) -> 'a

with_loc loc f runs the thunk f with loc as the new default location for emit and fatal. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See merge_loc.

val merge_loc : Range.t option -> (unit -> 'a) -> 'a

merge_loc loc f "merges" loc into the current default location for emit and fatal and runs the thunk f. By "merge", it means that if loc is None, then the current default location is kept; otherwise, it is overwritten. Note that with_loc None will clear the current default location, while merge_loc None will keep it. See with_loc.

Constructing Diagnostics

Functions in this section differ from the ones in Diagnostic (for example, Diagnostic.make) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)

val diagnostic : ?severity:Diagnostic.severity -> ?loc:Range.t -> ?text:Diagnostic.text -> ?backtrace:Diagnostic.backtrace -> ?extra_remarks:Diagnostic.loctext list -> Message.t -> - Message.t Diagnostic.t

diagnostic message constructs a diagnostic with the message along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic @@ SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

diagnostic message constructs a diagnostic with the message along with the backtrace frames recorded via trace.

Example:

Reporter.diagnostic @@ SyntaxError "too many emojis"
  • parameter severity

    The severity (to overwrite the default severity inferred from the message).

  • parameter loc

    The location of the text (usually the code) to highlight. The default value is the innermost location given by trace, with_loc, merge_loc, or run.

  • parameter text

    The text (to overwrite the default text inferred from the message).

  • parameter backtrace

    The backtrace (to overwrite the accumulative frames up to this point).

  • parameter extra_remarks

    Additional remarks that are not part of the backtrace.

Algebraic Effects

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 (see emit), and fatal to handle fatal diagnostics that have aborted the computation (see fatal).

  • 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.

val adopt : + 'a

run ~emit ~fatal f runs the thunk f, using emit to handle non-fatal diagnostics before continuing the computation (see emit), and fatal to handle fatal diagnostics that have aborted the computation (see fatal).

  • parameter init_loc

    The initial default location for inner emit and fatal. The default value is None.

  • 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.

val adopt : ('message Diagnostic.t -> Message.t Diagnostic.t) -> (?init_loc:Range.t -> ?init_backtrace:Diagnostic.backtrace ->