Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Allow using accessible as a function #76

Open
neko-kai opened this issue Nov 29, 2019 · 0 comments
Open

Allow using accessible as a function #76

neko-kai opened this issue Nov 29, 2019 · 0 comments

Comments

@neko-kai
Copy link
Member

neko-kai commented Nov 29, 2019

Expose generation of accessible forwarder as a blackbox macro method (blackbox is sufficient, the type is known ahead of time):

Example:

trait LaunchSite[-R] {
  def launchSite: LaunchSite.Service[R]
}

object LaunchSite {
  abstract class Service[-R] {
    def launchNukes: ZIO[R, Nothing, Nothing]
  }

  val launchSite: LaunchSite.Service[LaunchSite[Any]] = accessible
  // def accessible[S]: S = macro ???
}

Combining this with delegate allows service forwarders to be generated in an Intellij-friendly way:

class Proxy(@delegate s: LaunchSite.Service[Any]) extends LaunchSite.Service[Any]

object launchSite extends Proxy(accessible)

/cc @ioleo @mschuwalow

@neko-kai neko-kai changed the title Allow using accessible as a method Allow using accessible as a function Nov 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant