-
Notifications
You must be signed in to change notification settings - Fork 531
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
Problems deriving typeclass instances for types with type-members #868
Comments
Have you tried with latest scala 2.13? |
I quickly tried it with 2.13.0-M5 here; the results are the same except that the 4 annotated with " Is that what you expected? Is |
(aside: using shapeless 2.4.0-SNAPSHOT from current HEAD doesn't change things in 2.12 or 2.13.0-M5) |
By-name implicits are a replacement for I'm also wondering if you might get further with |
#797 makes all examples compile, except the expected ones. |
very cool, @joroKr21, thanks! hopefully it makes it in to 2.4.0 / soon. maybe I will experiment with using a fork that includes it. @milessabin interesting! I've looked at |
Fixed by #797 |
I thought
the[T]
⟹the[Lazy[T]]
, but here is a counterexample:scalafiddle
Digging further, there are a few issues deriving typeclass-instances (choosing from {Generic, LabelledGeneric} x {
Lazy
, non-Lazy
}) for "Aux"-style aliases (where the type-member being "Aux"'d may be an HKT or not):scalafiddle
All the 🚫's should compile but don't, afaict (expect the ones I marked as "expected").
The simplest description of this data I can come up with is: "derivations of types with type-members only work if the type-member is a non-HKT and the derivation is non-'labelled'".
Put another way:
LabelledGeneric
derivations in the presence of a type-member – and all derivations if it's an HKT-member – don't work.However, even these descriptions miss some subtleties about the how far the different cases get before they stop working.
This looks similar to #584, but that seems explicitly focused on tagged types; I'm not sure if #797 also fixes any/all of these.
The text was updated successfully, but these errors were encountered: