tofu icon indicating copy to clipboard operation
tofu copied to clipboard

Add support Scala 3 for module derivation

Open Roman-Statsura opened this issue 1 year ago • 1 comments

Add support Scala 3 for module derivation

But i couldn't migrate to Scala 3

  1. class InitDerivation
  2. And this:
Code
import derevo.{DerivationK2, DerivationKN11}
import tofu.higherKind.bi.{EmbedBK, RepresentableB}
import tofu.higherKind.{Embed, RepresentableK}

object representableK extends DerivationK2[RepresentableK] {
  def instance[T[_[_]]]: RepresentableK[T] = macro HigherKindedMacros.representableK[T]
}

object embed extends DerivationK2[Embed] {
  def instance[T[_[_]]]: Embed[T] = macro HigherKindedMacros.embed[T]
}

object representableB extends DerivationKN11[RepresentableB] {
  def instance[T[bf[_, _]]]: RepresentableB[T] = macro HigherKindedMacros.representableB[T]
}

object biembed extends DerivationKN11[EmbedBK] {
  def instance[T[fb[_, _]]]: EmbedBK[T] = macro HigherKindedMacros.embedB[T]
}

If you could tell me how this could be done, I would be grateful

Roman-Statsura avatar May 08 '24 08:05 Roman-Statsura

@Roman-Statsura Currently, there is no scala3 impl for HigherKindedMacros . In migrated modules we just do not migrate such parts on scala3.

It's hard tro say if this mofdule makes but it feel like this module doesn't make a lot of sence without this macro. So we need to wait for implementation of HigherKindedMacros

What about class InitDerivation - you can take a look at modules/logging/derivation/src/main/scala-2/tofu/logging/derivation/LoggingDerivationImpl.scala and modules/logging/derivation/src/main/scala-3/tofu/logging/derivation/LoggingDerivationImpl.scala

dos65 avatar May 14 '24 11:05 dos65