Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Expr.ofFunction1 #14138

Closed
wants to merge 2 commits into from
Closed

Add Expr.ofFunction1 #14138

wants to merge 2 commits into from

Conversation

Atry
Copy link
Contributor

@Atry Atry commented Dec 19, 2021

No description provided.

Co-authored-by: Dale Wijnand <dale.wijnand@gmail.com>
@dwijnand
Copy link
Member

I think we should mark this as @experimental, that way we can decide later if we want to commit to having it.

* to an expression equivalent to
* `'{ $a => $r }` typed as an `Expr[A => R]`
*/
def ofFunction1[A, R](f: Expr[A] => Expr[R])(using Type[R], Type[A])(using Quotes): Expr[A => R] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add this we should add it for all function arities. It seems that we would need TupledFunction (see #10416) to be able to write this interface for all function sizes.

* Transforms the expression
* `a => r` where `a: Expr[A]` and `r: Expr[R]`
* to an expression equivalent to
* `'{ $a => $r }` typed as an `Expr[A => R]`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you're adding a new method to stdlib's API you should mark it as@experimental

@nicolasstucki
Copy link
Contributor

We will not be able to advance on this before we have #14414. I will close this PR for now. We should revisit it once we have #14414.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants