kittens icon indicating copy to clipboard operation
kittens copied to clipboard

[Scala 3] Derivation for deeply nested types

Open TimWSpence opened this issue 3 years ago • 2 comments

In scala 2, the following is ok:

import auto.semigroupK._
implicitly[SemigroupK[Lambda[x => List[Set[Option[x]]]]]]

but the following in scala 3 does not compile:

import auto.semigroupK.given
summon[SemigroupK[[x] =>> List[Set[Option[x]]]]]

Naming and explicitly calling

given foo[F[_], G[_]](using F: Or[F]): DerivedSemigroupK[[x] =>> F[G[x]]] =
  F.unify.compose[G]

foo[List, [x] =>> Set[Option[x]]]

does work however.

I see the scala 2 version uses Split1 from Shapeless. Maybe we need something similar here?

TimWSpence avatar May 23 '22 15:05 TimWSpence

Oh no, definitely no Split1 😂 - that is a horrible hack. But worth it to investigate why it's not compiling 🤔

joroKr21 avatar May 23 '22 17:05 joroKr21

This is currently being tracked in https://github.com/lampepfl/dotty/issues/15344 but we are unable to support it for the moment

TimWSpence avatar Jul 20 '22 13:07 TimWSpence