typelevel / shapeless-3

Generic programming for Scala
189 stars 22 forks source link

Accommodate user-defined mirrors #219

Closed joroKr21 closed 6 months ago

joroKr21 commented 6 months ago

Fixes #218

joroKr21 commented 6 months ago

@tschuchortdev I tried this out in Kittens and unfortunately it degrades compiler performance significantly (rootJVM/Test/compile went from ~30s to ~60s). So I think we will have to put it behind an import after all.

tschuchortdev commented 6 months ago

Oh, that's too bad, but I guess it can't be avoided. Have you thought about putting an @implicitNotFound on Generic parameters to direct the user towards the import? I've just experimented with it a little bit and it seems that the custom error message is simply prepended to the compiler's message "failed to synthesize Generic because Foo is not a case class", meaning the error messages will not be worse in other cases if we add our own hint.

joroKr21 commented 6 months ago

Yes, this would make sense. Although I'm still waiting for a backport of @implicitNotFound for type aliases: https://github.com/scala/scala3/pull/20275

tschuchortdev commented 6 months ago

Looks good to me now.