ocaml-containers/dev/containers/CCParse/Infix/index.html
2021-09-26 00:58:26 +00:00

2 lines
No EOL
8.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Infix (containers.CCParse.Infix)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">containers</a> &#x00BB; <a href="../index.html">CCParse</a> &#x00BB; Infix</nav><h1>Module <code>CCParse.Infix</code></h1></header><dl><dt class="spec value" id="val-(&gt;|=)"><a href="#val-(&gt;|=)" class="anchor"></a><code><span class="keyword">val</span> (&gt;|=) : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Alias to <a href="../index.html#val-map"><code>map</code></a>. <code>p &gt;|= f</code> parses an item <code>x</code> using <code>p</code>, and returns <code>f x</code>.</p></dd></dl><dl><dt class="spec value" id="val-(&gt;&gt;=)"><a href="#val-(&gt;&gt;=)" class="anchor"></a><code><span class="keyword">val</span> (&gt;&gt;=) : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span>)</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Alias to <a href="../index.html#val-bind"><code>bind</code></a>. <code>p &gt;&gt;= f</code> results in a new parser which behaves as <code>p</code> then, in case of success, applies <code>f</code> to the result.</p></dd></dl><dl><dt class="spec value" id="val-(&lt;*&gt;)"><a href="#val-(&lt;*&gt;)" class="anchor"></a><code><span class="keyword">val</span> (&lt;*&gt;) : <span><span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Applicative.</p></dd></dl><dl><dt class="spec value" id="val-(&lt;*)"><a href="#val-(&lt;*)" class="anchor"></a><code><span class="keyword">val</span> (&lt;*) : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">_</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>a &lt;* b</code> parses <code>a</code> into <code>x</code>, parses <code>b</code> and ignores its result, and returns <code>x</code>.</p></dd></dl><dl><dt class="spec value" id="val-(*&gt;)"><a href="#val-(*&gt;)" class="anchor"></a><code><span class="keyword">val</span> (*&gt;) : <span><span class="type-var">_</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>a *&gt; b</code> parses <code>a</code>, then parses <code>b</code> into <code>x</code>, and returns <code>x</code>. The result of <code>a</code> is ignored.</p></dd></dl><dl><dt class="spec value" id="val-(&lt;|&gt;)"><a href="#val-(&lt;|&gt;)" class="anchor"></a><code><span class="keyword">val</span> (&lt;|&gt;) : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Alias to <a href="../index.html#val-or_"><code>or_</code></a>.</p><p><code>a &lt;|&gt; b</code> tries to parse <code>a</code>, and if <code>a</code> fails without consuming any input, backtracks and tries to parse <code>b</code>, otherwise it fails as <code>a</code>. See <a href="../index.html#val-try_"><code>try_</code></a> to ensure <code>a</code> does not consume anything (but it is best to avoid wrapping large parsers with <a href="../index.html#val-try_"><code>try_</code></a>).</p></dd></dl><dl><dt class="spec value" id="val-(&lt;?&gt;)"><a href="#val-(&lt;?&gt;)" class="anchor"></a><code><span class="keyword">val</span> (&lt;?&gt;) : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>a &lt;?&gt; msg</code> behaves like <code>a</code>, but if <code>a</code> fails, <code>a &lt;?&gt; msg</code> fails with <code>msg</code> instead. Useful as the last choice in a series of <code>&lt;|&gt;</code>. For example: <code>a &lt;|&gt; b &lt;|&gt; c &lt;?&gt; &quot;expected one of a, b, c&quot;</code>.</p></dd></dl><dl><dt class="spec value" id="val-(|||)"><a href="#val-(|||)" class="anchor"></a><code><span class="keyword">val</span> (|||) : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Alias to <a href="../index.html#val-both"><code>both</code></a>. <code>a ||| b</code> parses <code>a</code>, then <code>b</code>, then returns the pair of their results.</p><dl><dt>since</dt><dd>NEXT_RELEASE</dd></dl></dd></dl><div><div class="spec include"><div class="doc"><p>Let operators on OCaml &gt;= 4.08.0, nothing otherwise</p><dl><dt>since</dt><dd>2.8</dd></dl><details open="open"><summary><span class="def"><code><span class="keyword">include</span> <a href="../../CCShimsMkLet_/index.html#module-type-S">CCShimsMkLet_.S</a> <span class="keyword">with</span> <span class="keyword">type</span> <span>'a <a href="../../CCShimsMkLet_/module-type-S/index.html#type-t_let">t_let</a></span> := <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></span></summary><dl><dt class="spec type" id="type-t_let"><a href="#type-t_let" class="anchor"></a><code><span class="keyword">type</span> <span>'a t_let</span></code></dt></dl><dl><dt class="spec value" id="val-let+"><a href="#val-let+" class="anchor"></a><code><span class="keyword">val</span> let+ : <span><span class="type-var">'a</span> <a href="index.html#type-t_let">t_let</a></span> <span>&#45;&gt;</span> <span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span>)</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span></code></dt><dt class="spec value" id="val-and+"><a href="#val-and+" class="anchor"></a><code><span class="keyword">val</span> and+ : <span><span class="type-var">'a</span> <a href="index.html#type-t_let">t_let</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span> <span>&#45;&gt;</span> <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <a href="index.html#type-t_let">t_let</a></span></code></dt><dt class="spec value" id="val-let*"><a href="#val-let*" class="anchor"></a><code><span class="keyword">val</span> let* : <span><span class="type-var">'a</span> <a href="index.html#type-t_let">t_let</a></span> <span>&#45;&gt;</span> <span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span>)</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span></code></dt><dt class="spec value" id="val-and*"><a href="#val-and*" class="anchor"></a><code><span class="keyword">val</span> and* : <span><span class="type-var">'a</span> <a href="index.html#type-t_let">t_let</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span> <span>&#45;&gt;</span> <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <a href="index.html#type-t_let">t_let</a></span></code></dt></dl></details></div></div></div></div></body></html>