<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>EtaExpansion</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css">
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20201002</a>
</div>
</div>
<div id="header">
<h1>EtaExpansion</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>Eta expansion is a simple syntactic change used to work around the
<a href="ValueRestriction">ValueRestriction</a> in <a href="StandardML">Standard ML</a>.</p></div>
<div class="paragraph"><p>The eta expansion of an expression <span class="monospaced">e</span> is the expression
<span class="monospaced">fn z =&gt; e z</span>, where <span class="monospaced">z</span> does not occur in <span class="monospaced">e</span>.  This only
makes sense if <span class="monospaced">e</span> denotes a function, i.e. is of arrow type.  Eta
expansion delays the evaluation of <span class="monospaced">e</span> until the function is
applied, and will re-evaluate <span class="monospaced">e</span> each time the function is
applied.</p></div>
<div class="paragraph"><p>The name "eta expansion" comes from the eta-conversion rule of the
<a href="LambdaCalculus">lambda calculus</a>.  Expansion refers to the
directionality of the equivalence being used, namely taking <span class="monospaced">e</span> to
<span class="monospaced">fn z =&gt; e z</span> rather than <span class="monospaced">fn z =&gt; e z</span> to <span class="monospaced">e</span> (eta
contraction).</p></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
