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 List[Expr[T]] to Expr[List[T]] conversion in the library #5543

Merged

Conversation

nicolasstucki
Copy link
Contributor

Both scalatest and the interpolators need this operation and they are probably not the only ones.

def toExpr(implicit ev: Liftable[T]): Expr[T] = ev.toExpr(x)
}

implicit class ListOfExprOps[T](val list: List[Expr[T]]) extends AnyVal {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you have this conversion for free if you make Liftable[List[T]] implicitly available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, Liftable[List[T]] transforms List[T] into Expr[List[T]]. But here we transform List[Expr[T]] into Expr[List[T]].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a generalisation of your liftListOfAny.

@nicolasstucki
Copy link
Contributor Author

This PR may silently conflict with #5520

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM for this PR

Question for later: what about Seq?

@nicolasstucki
Copy link
Contributor Author

Seq should probably be implemented in a library.

@nicolasstucki nicolasstucki merged commit f0fbf4b into scala:master Dec 3, 2018
@nicolasstucki nicolasstucki deleted the add-tasty-list-of-expr-ops branch December 3, 2018 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants