transparent inline apply: how to achieve the apply syntax sugar? #19994
Answered bynicolasstucki
TomasMikula asked this question in Metaprogramming
-
Given a importscala.quoted.*classFoo[A]:transparentinlinedefapply=${Foo.go[A] } objectFoo:defgo[A](usingQuotes, Type[A]) =Type.of[A] matchcase'[Int] =>'{(n: Int) => n+1 } case _ =>'{(n: Nothing) => n }I'd like to be able to call @main defmain=valfoo=Foo[Int] foo.apply(1) // OK foo(1) // Error: method apply in class Foo does not take parametersIs it achievable (possibly using some inline given conversions)? |
BetaWas this translation helpful?Give feedback.
Answered by nicolasstucki Mar 21, 2024
Replies: 2 comments 1 reply
-
I am also looking for something like this for ops-mirror |
BetaWas this translation helpful?Give feedback.
0 replies
-
A workaround for this is - transparent inline def apply =+ transparent inline def apply(using inline di: DummyImplicit) = |
BetaWas this translation helpful?Give feedback.
1 reply
Answer selected byTomasMikula
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
A workaround for this is