-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use macro for implicit summoning in typeclass companion objects for Cats/Algebra/Spire #1667
Comments
And results in smaller jar size: the |
Have you seen https://github.com/non/imp? It seems to do most of what you propose, except for the |
As @non notes in the issues, the JVM can already optimize this and there is
little evidence this helps:
https://github.com/DarkDimius/imp-bench
…On Sat, May 13, 2017 at 20:24 Edmund Noble ***@***.***> wrote:
Have you seen https://github.com/non/imp? It seems to do most of what you
propose, except for the ImplicitSummoner traits. Paging @non
<https://github.com/non>, because the reason why we don't use imp in cats
is escaping me.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1667 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEJdv5_ppAikPJRMgBhK7_ksZb-yUV9ks5r5p4MgaJpZM4NaLX_>
.
|
@johnynek I just, just ran benchmarks to test if the JIT is doing this. If it is, we have to consider that not every piece of code is JITted and it never is on its first runs. JMH is giving us potentially unrealistic results because of this; my benchmarks have
|
@edmundnoble I was not aware of the |
Considering that the use of macros to generate boilerplate, such as done in #2925, it seems unlikely that this will be taken up. |
I agree, and the complexity only gets worse during the Scala 3 transition. |
I wrote a macro in this gist. This removes the boilerplate every companion object of typeclasses has (the
def apply[A](implicit A: Ev[A]) = A
method), and is faster: the method invocation is replaced by the actual typeclass instance filled by the macro.The text was updated successfully, but these errors were encountered: