DmytroMitin / AUXify

Introduces macro/meta annotations @ aux, @ self, @ instance, @ apply, @ delegated, @ syntax and String-based type class LabelledGeneric
Apache License 2.0
28 stars 3 forks source link

annotation @ poly ? #34

Open DmytroMitin opened 4 years ago

DmytroMitin commented 4 years ago

Transforms

@poly
trait MyTypeclass[In] {
  type Out
  def foo(in: In): Out
}

into

trait MyTypeclass[In] {
  type Out
  def foo(in: In): Out
}
object MyTypeclass {
  object myTypeclassPoly extends Poly1 {
    implicit def cse(implicit mtc: MyTypeclass[In]): Case.Aux[In, mtc.Out] = at(in => mtc.foo(in))
  }
}
DmytroMitin commented 4 years ago

Conflicts with shapeless.poly? Rename to polymorphic, polymorph, polyFunction?

DmytroMitin commented 4 years ago

Implementation of @poly should be similar to @apply.