Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / EtaExpansion.adoc
1 EtaExpansion
2 ============
3
4 Eta expansion is a simple syntactic change used to work around the
5 <:ValueRestriction:> in <:StandardML:Standard ML>.
6
7 The eta expansion of an expression `e` is the expression
8 `fn z => e z`, where `z` does not occur in `e`. This only
9 makes sense if `e` denotes a function, i.e. is of arrow type. Eta
10 expansion delays the evaluation of `e` until the function is
11 applied, and will re-evaluate `e` each time the function is
12 applied.
13
14 The name "eta expansion" comes from the eta-conversion rule of the
15 <:LambdaCalculus:lambda calculus>. Expansion refers to the
16 directionality of the equivalence being used, namely taking `e` to
17 `fn z => e z` rather than `fn z => e z` to `e` (eta
18 contraction).