mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
2 lines
No EOL
4.8 KiB
HTML
2 lines
No EOL
4.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="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 class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> (<span class="type-var">'a</span> <span>-></span> <span class="type-var">'b</span>) <span>-></span> <span class="type-var">'b</span> <a href="../index.html#type-t">t</a></code></dt><dd><p>Map.</p></dd></dl><dl><dt class="spec value" id="val-(>>=)"><a href="#val-(>>=)" class="anchor"></a><code><span class="keyword">val</span> (>>=) : <span class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> (<span class="type-var">'a</span> <span>-></span> <span class="type-var">'b</span> <a href="../index.html#type-t">t</a>) <span>-></span> <span class="type-var">'b</span> <a href="../index.html#type-t">t</a></code></dt><dd><p>Monadic bind. <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 class="type-var">'a</span> <span>-></span> <span class="type-var">'b</span>) <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'b</span> <a href="../index.html#type-t">t</a></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 class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">_</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a></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 class="type-var">_</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a></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 results 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 class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a></code></dt><dd><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 class="type-var">'a</span> <a href="../index.html#type-t">t</a> <span>-></span> string <span>-></span> <span class="type-var">'a</span> <a href="../index.html#type-t">t</a></code></dt><dd><p><code>a <?> msg</code> behaves like <code>a</code>, but if <code>a</code> fails without consuming any input, it fails with <code>msg</code> instead. Useful as the last choice in a series of <code><|></code>: <code>a <|> b <|> c <?> "expected a|b|c"</code>.</p></dd></dl></div></body></html> |