Skip to content

Commit

Permalink
Fix HOAS pattern example
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Feb 9, 2024
1 parent 9d9bf61 commit d332cb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/_docs/reference/metaprogramming/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@ The lambda arguments will replace the variables that might have been extruded.

```scala
'{ ((x: Int) => x + 1).apply(2) } match
case '{ ((y: Int) => $f(y)).apply($z: Int) } =>
case '{ ((y: Int) => $f(y): Int).apply($z: Int) } =>
// f may contain references to `x` (replaced by `$y`)
// f = (y: Expr[Int]) => '{ $y + 1 }
f(z) // generates '{ 2 + 1 }
// f = '{ (y: Int) => $y + 1 }
Expr.betaReduce('{ $f($z)}) // generates '{ 2 + 1 }
```


Expand Down

0 comments on commit d332cb0

Please sign in to comment.