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

Allow generic types in shared traits #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mariusmuja
Copy link

This PR adds support for higher kinded generic parameters to use for return types in the shared interface, such as:

// shared interface
trait Api[F[_]]{
  def add(x: Int, y: Int, z: Int): F[Int]
}

This is very useful when using tagless final encoding for the algebras used in the program.

For macro application, one needs to use Future for the generic type, for example:

Client[Api[Future]].add(1, 2, 3).call()

but it's possible to make use libraries such as mainecoon, to have the Future interpreter automatically deduced from any other type for which a natural transformation is available.

@mariusmuja mariusmuja changed the title Allow generic return type in shared traits Allow generic types in shared traits Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant