You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.6 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>IStdlib__IOption (infer.IStdlib__IOption)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><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">infer</a> &#x00BB; IStdlib__IOption</nav><h1>Module <code>IStdlib__IOption</code></h1></header><dl><dt class="spec value" id="val-find_value_exn"><a href="#val-find_value_exn" class="anchor"></a><code><span class="keyword">val</span> find_value_exn : <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dd><p>Like <code>Option.value_exn</code> but raises <code>Caml.Not_found</code> when called with <code>None</code>.</p></dd></dl><dl><dt class="spec value" id="val-value_default_f"><a href="#val-value_default_f" class="anchor"></a><code><span class="keyword">val</span> value_default_f : <span>f:<span>(unit <span>&#45;&gt;</span> <span class="type-var">'a</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dd><p>Like <code>Option.value ~default:(f ())</code> but <code>f</code> is called only if <code>None</code>.</p></dd></dl><dl><dt class="spec value" id="val-if_none_evalopt"><a href="#val-if_none_evalopt" class="anchor"></a><code><span class="keyword">val</span> if_none_evalopt : <span>f:<span>(unit <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span></code></dt><dd><p><code>if_none_evalopt ~f x</code> evaluates to <code>f ()</code> if <code>x = None</code>, otherwise returns <code>x</code>. Useful for chaining matchers where the first returning non-<code>None</code> determines the result.</p></dd></dl><dl><dt class="spec value" id="val-if_none_eval"><a href="#val-if_none_eval" class="anchor"></a><code><span class="keyword">val</span> if_none_eval : <span>f:<span>(unit <span>&#45;&gt;</span> <span class="type-var">'a</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dd><p><code>if_none_eval ~f x</code> evaluates to <code>y</code> if <code>x=Some y</code> else to <code>f ()</code>. Useful for terminating chains built with <code>if_none_evalopt</code>. This is exactly the same as <code>value_default_f</code> but with a better name.</p></dd></dl><dl><dt class="spec value" id="val-exists2"><a href="#val-exists2" class="anchor"></a><code><span class="keyword">val</span> exists2 : <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> option</span> <span>&#45;&gt;</span> <span>f:<span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'b</span> <span>&#45;&gt;</span> bool)</span></span> <span>&#45;&gt;</span> bool</code></dt><dd><p>Like <code>Option.exists</code> but gets two parameters.</p></dd></dl><dl><dt class="spec value" id="val-map_changed"><a href="#val-map_changed" class="anchor"></a><code><span class="keyword">val</span> map_changed : <span><span class="type-var">'a</span> option</span> <span>&#45;&gt;</span> <span>equal:<span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> bool)</span></span> <span>&#45;&gt;</span> <span>f:<span>(<span class="type-var">'a</span> <span>&#45;&gt;</span> <span class="type-var">'a</span>)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> option</span></code></dt><dd><p>Like <code>Option.map</code> but maintain physical equality</p></dd></dl><div><div c