File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
docs/docs/reference/metaprogramming Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -135,24 +135,24 @@ expressiveness.
135135
136136### From ` Expr ` s to Functions and Back
137137
138- The ` Expr ` companion object contains an implicit ` AsFunctionN ` (for 0 <= N < 23) conversion that turns a tree
138+ The ` Expr ` companion object contains an implicit ` FunctionBetaReduction ` conversion that turns a tree
139139describing a function into a function mapping trees to trees.
140140``` scala
141141 object Expr {
142142 ...
143- implied AsFunction1 [ T , U ] for Conversion [ Expr [ T => U ], Expr [ T ] => Expr [ U ]] ...
143+ implicit class FunctionBetaReduction [...](...) { ... }
144144 }
145145```
146146This decorator gives ` Expr ` the ` apply ` operation of an applicative functor, where ` Expr ` s
147147over function types can be applied to ` Expr ` arguments. The definition
148- of ` AsFunction1 (f).apply(x)` is assumed to be functionally the same as
148+ of ` FunctionBetaReduction (f).apply(x)` is assumed to be functionally the same as
149149` '{($f)($x)} ` , however it should optimize this call by returning the
150150result of beta-reducing ` f(x) ` if ` f ` is a known lambda expression.
151151
152- The ` AsFunction1 ` decorator distributes applications of ` Expr ` over function
152+ The ` FunctionBetaReduction ` decorator distributes applications of ` Expr ` over function
153153arrows:
154154``` scala
155- AsFunction1 (_ ).apply: Expr [S => T ] => (Expr [S ] => Expr [T ])
155+ FunctionBetaReduction (f ).apply: Expr [S => T ] => (Expr [S ] => Expr [T ])
156156```
157157Its dual, let’s call it ` reflect ` , can be defined as follows:
158158``` scala
You can’t perform that action at this time.
0 commit comments