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