This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!DOCTYPE html>
<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>PhysEqual (infer.IStdlib.PhysEqual)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.1"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><scriptsrc="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divclass="content"><header><nav><ahref="../index.html">Up</a>–<ahref="../../index.html">infer</a>»<ahref="../index.html">IStdlib</a>» PhysEqual</nav><h1>Module <code>IStdlib.PhysEqual</code></h1></header><aside><p>Helpers function to enforce physical equality.</p><p>Let suppose <code>construct/deconstruct</code> is a 1-level-allocation OCaml construction/deconstruction, such as variant type, tuple or record construction. Instead of writing</p><pre><codeclass="ml">let a = deconstruct a0 in
let b = deconstruct b0 in
let res = f a b in
if phys_equal res a then a0 else if phys_equal res b then b0 else construct res</code></pre><p>Simply write</p><pre><codeclass="ml">PhysEqual.optim2 ~res:(construct (f a b)) a0 b0 </code></pre></aside><dl><dtclass="spec value"id="val-optim1"><ahref="#val-optim1"class="anchor"></a><code><spanclass="keyword">val</span> optim1 : <span>res:<spanclass="type-var">'a</span></span><span>-></span><spanclass="type-var">'a</span><span>-></span><spanclass="type-var">'a</span></code></dt><dtclass="spec value"id="val-optim2"><ahref="#val-optim2"class="anchor"></a><code><spanclass="keyword">val</span> optim2 : <span>res:<spanclass="type-var">'a</span></span><span>-></span><spanclass="type-var">'a</span><span>-></span><spanclass="type-var">'a</span><span>-></span><spanclass="type-var">'a</span></code></dt></dl></div></body></html>