@@ -28,20 +28,16 @@ package quoted {
2828 /** Converts a tuple `(T1, ..., Tn)` to `(Expr[T1], ..., Expr[Tn])` */
2929 type TupleOfExpr [Tup <: Tuple ] = Tuple .Map [Tup , [X ] =>> (given QuoteContext ) => Expr [X ]]
3030
31- implicit class AsFunction [F , Args <: Tuple , R ](f : Expr [F ])(given tf : TupledFunction [F , Args => R ], qctx : QuoteContext ) {
32- /** Beta-reduces the function appication. Generates the an expression only containing the body of the function */
33- def apply [G ](given tg : TupledFunction [G , TupleOfExpr [Args ] => Expr [R ]]): G = {
34- import qctx .tasty ._
35- tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf [QuoteContext => Expr [_]](qctx).unseal)).seal.asInstanceOf [Expr [R ]])
36- }
31+ /** Beta-reduces the function appication. Generates the an expression only containing the body of the function */
32+ def reduce [F , Args <: Tuple , R , G ](f : Expr [F ])(given tf : TupledFunction [F , Args => R ], tg : TupledFunction [G , TupleOfExpr [Args ] => Expr [R ]], qctx : QuoteContext ): G = {
33+ import qctx .tasty ._
34+ tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf [QuoteContext => Expr [_]](qctx).unseal)).seal.asInstanceOf [Expr [R ]])
3735 }
3836
39- implicit class AsContextualFunction [F , Args <: Tuple , R ](f : Expr [F ])(given tf : TupledFunction [F , (given Args ) => R ], qctx : QuoteContext ) {
40- /** Beta-reduces the function appication. Generates the an expression only containing the body of the function */
41- def apply [G ](given tg : TupledFunction [G , TupleOfExpr [Args ] => Expr [R ]]): G = {
42- import qctx .tasty ._
43- tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf [QuoteContext => Expr [_]](qctx).unseal)).seal.asInstanceOf [Expr [R ]])
44- }
37+ /** Beta-reduces the function appication. Generates the an expression only containing the body of the function */
38+ def reduceGiven [F , Args <: Tuple , R , G ](f : Expr [F ])(given tf : TupledFunction [F , (given Args ) => R ], tg : TupledFunction [G , TupleOfExpr [Args ] => Expr [R ]], qctx : QuoteContext ): G = {
39+ import qctx .tasty ._
40+ tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf [QuoteContext => Expr [_]](qctx).unseal)).seal.asInstanceOf [Expr [R ]])
4541 }
4642
4743 /** Returns a null expresssion equivalent to `'{null}` */
0 commit comments