package asai

  1. Overview
  2. Docs

This module provides functions to display or interact with diagnostics in UNIX terminals. A message will look like this:

    ๐Ÿญ examples/stlc/example.lambda
    โ”‚
  1 โ”‚ (check (ฮป รค (ฮป 123
  2 โ”‚   sdaf)) (โ†’ โ„• (โ†’ โ„• โ„•)))
    โ”Š
 20 โ”‚ ahhhhhhhhhhhhhhhhhh
 21 โ”‚ noooooooooooooooooo
    โ”ท
 [E002] Why am I checking the term (โ†’ โ„• (โ†’ โ„• โ„•)),
        which looks amazing?

Parameters

Signature

val display : ?show_backtrace:bool -> ?line_breaking:[ `Unicode | `Traditional ] -> ?block_splitting_threshold:int -> ?tab_size:int -> Code.t Diagnostic.t -> unit

display d prints the diagnostic d to the standard output, using terminal control characters for formatting. A message will look like this:

    ๐Ÿญ examples/stlc/example1.lambda
    โ”‚
  1 โ”‚ (check (ฮป รค (ฮป 123
  2 โ”‚   sdaf)) (โ†’ โ„• (โ†’ โ„• โ„•)))
    โ”Š
 20 โ”‚ ahhhhhhhhhhhhhhhhhh
 21 โ”‚ noooooooooooooooooo
    โ”ท
    ๐Ÿญ examples/stlc/example2.lambda
    โ”‚
  3 โ”‚ let x = 1 // additional information
  4 โ”‚ let y = 1
    โ”ท
    ๐Ÿญ examples/stlc/example3.lambda
    โ”‚
  8 โ”‚ assert (asai is cool)
    โ”ท
 [E002] Why am I checking the term (โ†’ โ„• (โ†’ โ„• โ„•))?
  • parameter show_backtrace

    Whether the backtrace should be shown. The default is false.

  • parameter line_breaking

    The algorithm to recognize (hard) line breaks. The `Unicode algorithm recognizes all Unicode character sequences in Unicode 15.0.0 Table 5-1 as line breaks. The `Traditional algorithm only recognizes U+000A (LF), U+000D (CR), and U+000D U+000A (CRLF) as line breaks. The default is the `Traditional algorithm.

  • parameter block_splitting_threshold

    The maximum number of consecutive, non-highlighted lines allowed in a block. The function will try to minimize the number of blocks, as long as no block has too many consecutive, non-highlighted lines. A higher threshold will lead to fewer blocks. When the threshold is zero, it means no block can contain any non-highlighted line. The default value is 5.

  • parameter tab_size

    The number of spaces that should be used to replace a horizontal tab. Note that a horizontal tab is always expanded to the same number of spaces. The result should still be visually appealing as long as horizontal tabs are only used at the beginning of lines. The default value is 8.

  • raises Invalid_argument

    if tab_size < 0.

val interactive_trace : ?line_breaking:[ `Unicode | `Traditional ] -> ?block_splitting_threshold:int -> ?tab_size:int -> Code.t Diagnostic.t -> unit

interactive_trace d drops the user in a small interactive terminal app where they can cycle through the message provided in d and its backtrace.

  • parameter line_breaking

    The algorithm to recognize (hard) line breaks. The `Unicode algorithm recognizes all Unicode character sequences in Unicode 15.0.0 Table 5-1 as line breaks. The `Traditional algorithm only recognizes U+000A (LF), U+000D (CR), and U+000D U+000A (CRLF) as line breaks. The default is the `Traditional algorithm.

  • parameter block_splitting_threshold

    The maximum number of consecutive, non-highlighted lines allowed in a block. The function will try to minimize the number of blocks, as long as no block has too many consecutive, non-highlighted lines. A higher threshold will lead to fewer blocks. When the threshold is zero, it means no block can contain any non-highlighted line. The default value is 5.

  • parameter tab_size

    The number of spaces that should be used to replace a horizontal tab. Note that a horizontal tab is always expanded to the same number of spaces. The result should still be visually appealing as long as horizontal tabs are only used at the beginning of lines. The default value is 8.

  • raises Invalid_argument

    if tab_size < 0.

OCaml

Innovation. Community. Security.