Skip to content
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

annotation @ poly ? #34

Open
DmytroMitin opened this issue Jun 16, 2020 · 2 comments
Open

annotation @ poly ? #34

DmytroMitin opened this issue Jun 16, 2020 · 2 comments
Labels
enhancement New feature or request macros

Comments

@DmytroMitin
Copy link
Owner

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 DmytroMitin added enhancement New feature or request macros labels Jun 16, 2020
@DmytroMitin
Copy link
Owner Author

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

@DmytroMitin
Copy link
Owner Author

Implementation of @poly should be similar to @apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request macros
Projects
None yet
Development

No branches or pull requests

1 participant