Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / EtaExpansion
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>EtaExpansion</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
9
10
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
13 /*<![CDATA[*/
14 asciidoc.install();
15 /*]]>*/
16 </script>
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
18 </head>
19 <body class="article">
20 <div id="banner">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
23 </div>
24 </div>
25 <div id="header">
26 <h1>EtaExpansion</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
30 <div class="sectionbody">
31 <div class="paragraph"><p>Eta expansion is a simple syntactic change used to work around the
32 <a href="ValueRestriction">ValueRestriction</a> in <a href="StandardML">Standard ML</a>.</p></div>
33 <div class="paragraph"><p>The eta expansion of an expression <span class="monospaced">e</span> is the expression
34 <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
35 makes sense if <span class="monospaced">e</span> denotes a function, i.e. is of arrow type. Eta
36 expansion delays the evaluation of <span class="monospaced">e</span> until the function is
37 applied, and will re-evaluate <span class="monospaced">e</span> each time the function is
38 applied.</p></div>
39 <div class="paragraph"><p>The name "eta expansion" comes from the eta-conversion rule of the
40 <a href="LambdaCalculus">lambda calculus</a>. Expansion refers to the
41 directionality of the equivalence being used, namely taking <span class="monospaced">e</span> to
42 <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
43 contraction).</p></div>
44 </div>
45 </div>
46 </div>
47 <div id="footnotes"><hr></div>
48 <div id="footer">
49 <div id="footer-text">
50 </div>
51 <div id="footer-badges">
52 </div>
53 </div>
54 </body>
55 </html>