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