mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
2 lines
No EOL
8.8 KiB
HTML
2 lines
No EOL
8.8 KiB
HTML
<!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> » <a href="../index.html">CCParse</a> » Infix</nav><h1>Module <code>CCParse.Infix</code></h1></header><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>-></span> <span>(<span class="type-var">'a</span> <span>-></span> <span class="type-var">'b</span>)</span> <span>-></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 >|= 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-(>>=)"><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>-></span> <span>(<span class="type-var">'a</span> <span>-></span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span>)</span> <span>-></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 >>= 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-(<*>)"><a href="#val-(<*>)" class="anchor"></a><code><span class="keyword">val</span> (<*>) : <span><span>(<span class="type-var">'a</span> <span>-></span> <span class="type-var">'b</span>)</span> <a href="../index.html#type-t">t</a></span> <span>-></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>-></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-(<*)"><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>-></span> <span><span class="type-var">_</span> <a href="../index.html#type-t">t</a></span> <span>-></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>a <* 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-(*>)"><a href="#val-(*>)" class="anchor"></a><code><span class="keyword">val</span> (*>) : <span><span class="type-var">_</span> <a href="../index.html#type-t">t</a></span> <span>-></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>-></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>a *> 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-(<|>)"><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>-></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>-></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 <|> 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-(<?>)"><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>-></span> string <span>-></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>a <?> msg</code> behaves like <code>a</code>, but if <code>a</code> fails, <code>a <?> msg</code> fails with <code>msg</code> instead. Useful as the last choice in a series of <code><|></code>. For example: <code>a <|> b <|> c <?> "expected one of a, b, c"</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>-></span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span> <span>-></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 >= 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>-></span> <span>(<span class="type-var">'a</span> <span>-></span> <span class="type-var">'b</span>)</span> <span>-></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>-></span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span> <span>-></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>-></span> <span>(<span class="type-var">'a</span> <span>-></span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span>)</span> <span>-></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>-></span> <span><span class="type-var">'b</span> <a href="index.html#type-t_let">t_let</a></span> <span>-></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> |