= Expand fun expression = The “Expand fun expression” transformation expands an implicit fun expression into an explicit one. This transformation can be done separately, but sometimes it is needed by other transformations as a compensation step. One such example is the module-qualifier correction in the “move function” refactoring. When an implicit fun expression need module qualifying, the result will be like this: {{{fun module:function/2}}}. This form is not supported in older Erlang versions. But when we expand the fun expression, a simple function application appear instead of the short form ({{{fun function/2}}} equals to {{{fun(V1, V2) -> function(V1, V2) end}}}, and it will become able to module qualifying. When we want to modify the function application or just don’t want to use this syntactical sugar (the implicit form of fun expression), we can use this transformation to expand the expression. Expanding the fun expression {{{fun far:away/2}}}: {{{ -module(near). -export([f/0]). f() -> fun far:away/2. }}} Result: {{{ -module(near). -export([f/0]). f() -> fun(V1, V2) -> far:away(V1, V2) end. }}} == Side conditions == * The selected expression should be an implicit fun expression or part/subexpression of an implicit fun expression. == Transformation steps and compensations == 1. If the implicit fun expression is found, the new syntax structure is created and the old expression is replaced with the new one.