Skip to content

Commit

Permalink
deploy: e2c172c
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed Oct 10, 2023
1 parent 1b982cf commit d55279d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions asai/Asai/Reporter/Make/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
with_backtrace Emp @@ fun () -&gt; ...</code></pre></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-trace"><a href="#val-trace" class="anchor"></a><code><span><span class="keyword">val</span> trace : <span><span class="optlabel">?loc</span>:<a href="../../Span/index.html#type-t">Span.t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>trace str f</code> records the string <code>str</code> and runs the thunk <code>f</code> with the new backtrace.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">loc</span> <p>The location of the text (usually the code) to highlight.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-tracef"><a href="#val-tracef" class="anchor"></a><code><span><span class="keyword">val</span> tracef :
<span><span class="optlabel">?loc</span>:<a href="../../Span/index.html#type-t">Span.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="type-var">'a</span>, <span class="xref-unresolved">Stdlib</span>.Format.formatter, unit, <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="xref-unresolved">Stdlib</span>.format4</span> <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>tracef format ... f</code> formats and records a loctext as a frame in the backtrace, and runs the thunk <code>f</code> with the new backtrace. Note that there should not be any literal control characters. See <a href="../../Diagnostic/index.html#type-text"><code>Diagnostic.text</code></a>.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">loc</span> <p>The location of the text (usually the code) to highlight.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-trace_text"><a href="#val-trace_text" class="anchor"></a><code><span><span class="keyword">val</span> trace_text : <span><span class="optlabel">?loc</span>:<a href="../../Span/index.html#type-t">Span.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Diagnostic/index.html#type-text">Diagnostic.text</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>trace_text text f</code> records the <code>text</code> and runs the thunk <code>f</code> with the new backtrace.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">loc</span> <p>The location of the text (usually the code) to highlight.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-trace_loctext"><a href="#val-trace_loctext" class="anchor"></a><code><span><span class="keyword">val</span> trace_loctext : <span><a href="../../Diagnostic/index.html#type-loctext">Diagnostic.loctext</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>trace_loctext loctext f</code> records the <code>loctext</code> and runs the thunk <code>f</code> with the new backtrace.</p></div></div><h3 id="locations"><a href="#locations" class="anchor"></a>Locations</h3><div class="odoc-spec"><div class="spec value anchored" id="val-get_loc"><a href="#val-get_loc" class="anchor"></a><code><span><span class="keyword">val</span> get_loc : <span>unit <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Span/index.html#type-t">Span.t</a> option</span></span></code></div><div class="spec-doc"><p><code>get_loc()</code> returns the current location.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_loc"><a href="#val-with_loc" class="anchor"></a><code><span><span class="keyword">val</span> with_loc : <span><span><a href="../../Span/index.html#type-t">Span.t</a> option</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>with_loc loc f</code> runs the thunk <code>f</code> with <code>loc</code> as the initial location <code>loc</code>. Note that <code>with_loc None</code> will clear the current location, while <code>merge_loc None</code> will keep it. See <a href="#val-merge_loc"><code>merge_loc</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-merge_loc"><a href="#val-merge_loc" class="anchor"></a><code><span><span class="keyword">val</span> merge_loc : <span><span><a href="../../Span/index.html#type-t">Span.t</a> option</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>merge_loc loc f</code> &quot;merges&quot; <code>loc</code> into the current location and runs the thunk <code>f</code>. By &quot;merge&quot;, it means that if <code>loc</code> is <code>None</code>, then the current location is kept; otherwise, it is overwritten. Note that <code>with_loc None</code> will clear the current location, while <code>merge_loc None</code> will keep it. See <a href="#val-with_loc"><code>with_loc</code></a>.</p></div></div><h3 id="constructing-diagnostics"><a href="#constructing-diagnostics" class="anchor"></a>Constructing Diagnostics</h3><p>Functions in this section differ from the ones in <a href="../../Diagnostic/index.html"><code>Diagnostic</code></a> (for example, <a href="../../Diagnostic/index.html#val-make"><code>Diagnostic.make</code></a>) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)</p><div class="odoc-spec"><div class="spec value anchored" id="val-diagnostic"><a href="#val-diagnostic" class="anchor"></a><code><span><span class="keyword">val</span> diagnostic :
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>tracef format ... f</code> formats and records a frame in the backtrace, and runs the thunk <code>f</code> with the new backtrace. Note that there should not be any literal control characters. See <a href="../../Diagnostic/index.html#type-text"><code>Diagnostic.text</code></a>.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">loc</span> <p>The location of the text (usually the code) to highlight.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-trace_text"><a href="#val-trace_text" class="anchor"></a><code><span><span class="keyword">val</span> trace_text : <span><span class="optlabel">?loc</span>:<a href="../../Span/index.html#type-t">Span.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Diagnostic/index.html#type-text">Diagnostic.text</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>trace_text text f</code> records the <code>text</code> and runs the thunk <code>f</code> with the new backtrace.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">loc</span> <p>The location of the text (usually the code) to highlight.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-trace_loctext"><a href="#val-trace_loctext" class="anchor"></a><code><span><span class="keyword">val</span> trace_loctext : <span><a href="../../Diagnostic/index.html#type-loctext">Diagnostic.loctext</a> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>trace_loctext loctext f</code> records the <code>loctext</code> and runs the thunk <code>f</code> with the new backtrace.</p></div></div><h3 id="locations"><a href="#locations" class="anchor"></a>Locations</h3><div class="odoc-spec"><div class="spec value anchored" id="val-get_loc"><a href="#val-get_loc" class="anchor"></a><code><span><span class="keyword">val</span> get_loc : <span>unit <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Span/index.html#type-t">Span.t</a> option</span></span></code></div><div class="spec-doc"><p><code>get_loc()</code> returns the current location.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_loc"><a href="#val-with_loc" class="anchor"></a><code><span><span class="keyword">val</span> with_loc : <span><span><a href="../../Span/index.html#type-t">Span.t</a> option</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>with_loc loc f</code> runs the thunk <code>f</code> with <code>loc</code> as the initial location <code>loc</code>. Note that <code>with_loc None</code> will clear the current location, while <code>merge_loc None</code> will keep it. See <a href="#val-merge_loc"><code>merge_loc</code></a>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-merge_loc"><a href="#val-merge_loc" class="anchor"></a><code><span><span class="keyword">val</span> merge_loc : <span><span><a href="../../Span/index.html#type-t">Span.t</a> option</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>merge_loc loc f</code> &quot;merges&quot; <code>loc</code> into the current location and runs the thunk <code>f</code>. By &quot;merge&quot;, it means that if <code>loc</code> is <code>None</code>, then the current location is kept; otherwise, it is overwritten. Note that <code>with_loc None</code> will clear the current location, while <code>merge_loc None</code> will keep it. See <a href="#val-with_loc"><code>with_loc</code></a>.</p></div></div><h3 id="constructing-diagnostics"><a href="#constructing-diagnostics" class="anchor"></a>Constructing Diagnostics</h3><p>Functions in this section differ from the ones in <a href="../../Diagnostic/index.html"><code>Diagnostic</code></a> (for example, <a href="../../Diagnostic/index.html#val-make"><code>Diagnostic.make</code></a>) in that they fill out the current location, the current backtrace, and the severity automatically. (One can still overwrite them with optional arguments.)</p><div class="odoc-spec"><div class="spec value anchored" id="val-diagnostic"><a href="#val-diagnostic" class="anchor"></a><code><span><span class="keyword">val</span> diagnostic :
<span><span class="optlabel">?severity</span>:<a href="../../Diagnostic/index.html#type-severity">Diagnostic.severity</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?loc</span>:<a href="../../Span/index.html#type-t">Span.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?backtrace</span>:<a href="../../Diagnostic/index.html#type-backtrace">Diagnostic.backtrace</a> <span class="arrow">&#45;&gt;</span></span>
Expand Down Expand Up @@ -74,10 +74,9 @@
?init_backtrace:(Some (get_backtrace()))
~emit:(fun d -&gt; emit_diagnostic (m d))
~fatal:(fun d -&gt; fatal_diagnostic (m d))
f</code></pre><p>Here shows the intended usage, where <code>Lib</code> is the library to be used in the main application:</p><pre class="language-ocaml"><code>module MainReporter = Reporter.Make(Message)
module LibReporter = Lib.Reporter
f</code></pre><p>Here shows the intended usage, where <code>Lib</code> is the library to be used in the main application:</p><pre class="language-ocaml"><code>module LibReporter = Lib.Reporter

let _ = MainReporter.adopt (Diagnostic.map message_mapper) LibReporter.run @@ fun () -&gt; ...</code></pre></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-try_with"><a href="#val-try_with" class="anchor"></a><code><span><span class="keyword">val</span> try_with :
let _ = Reporter.adopt (Diagnostic.map message_mapper) LibReporter.run @@ fun () -&gt; ...</code></pre></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-try_with"><a href="#val-try_with" class="anchor"></a><code><span><span class="keyword">val</span> try_with :
<span><span class="optlabel">?emit</span>:<span>(<span><span><a href="argument-1-Message/index.html#type-t">Message.t</a> <a href="../../Diagnostic/index.html#type-t">Diagnostic.t</a></span> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?fatal</span>:<span>(<span><span><a href="argument-1-Message/index.html#type-t">Message.t</a> <a href="../../Diagnostic/index.html#type-t">Diagnostic.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span>
Expand All @@ -88,7 +87,7 @@
try_with
~fatal:(fun d -&gt; fatal_diagnostic (m d))
~emit:(fun d -&gt; emit_diagnostic (m d))
f</code></pre><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.2.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-map_text"><a href="#val-map_text" class="anchor"></a><code><span><span class="keyword">val</span> map_text : <span><span>(<span><a href="../../Diagnostic/index.html#type-text">Diagnostic.text</a> <span class="arrow">&#45;&gt;</span></span> <a href="../../Diagnostic/index.html#type-text">Diagnostic.text</a>)</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>map_text m f</code> runs the thunk <code>f</code> and applies <code>m</code> to any text sent by <code>f</code>. It is a convenience function that can be implemented as follows:</p><pre class="language-ocaml"><code>let map_text m f = map_diagnostic (Diagnostic.map_text m) f</code></pre><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.2.0</li></ul></div></div><h3 id="debugging"><a href="#debugging" class="anchor"></a>Debugging</h3><div class="odoc-spec"><div class="spec value anchored" id="val-register_printer"><a href="#val-register_printer" class="anchor"></a><code><span><span class="keyword">val</span> register_printer :
f</code></pre><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.2.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-map_text"><a href="#val-map_text" class="anchor"></a><code><span><span class="keyword">val</span> map_text : <span><span>(<span><a href="../../Diagnostic/index.html#type-text">Diagnostic.text</a> <span class="arrow">&#45;&gt;</span></span> <a href="../../Diagnostic/index.html#type-text">Diagnostic.text</a>)</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>map_text m f</code> runs the thunk <code>f</code> and applies <code>m</code> to the main text of any diagnostic sent by <code>f</code>. It is a convenience function that can be implemented as follows:</p><pre class="language-ocaml"><code>let map_text m f = map_diagnostic (Diagnostic.map_text m) f</code></pre><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.2.0</li></ul></div></div><h3 id="debugging"><a href="#debugging" class="anchor"></a>Debugging</h3><div class="odoc-spec"><div class="spec value anchored" id="val-register_printer"><a href="#val-register_printer" class="anchor"></a><code><span><span class="keyword">val</span> register_printer :
<span><span>(<span><span>[ `Trace
<span><span>| `Emit</span> of <span><a href="argument-1-Message/index.html#type-t">Message.t</a> <a href="../../Diagnostic/index.html#type-t">Diagnostic.t</a></span></span>
<span><span>| `Fatal</span> of <span><a href="argument-1-Message/index.html#type-t">Message.t</a> <a href="../../Diagnostic/index.html#type-t">Diagnostic.t</a></span></span> ]</span> <span class="arrow">&#45;&gt;</span></span>
Expand Down
Loading

0 comments on commit d55279d

Please sign in to comment.