<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>IStdlib__PhysEqual (infer.IStdlib__PhysEqual)</title><linkrel="stylesheet"href="../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.2"/><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>» IStdlib__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
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>