-
Notifications
You must be signed in to change notification settings - Fork 37
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
Replace @free with @tagless, and drop the requirement of an annotation #92
Replace @free with @tagless, and drop the requirement of an annotation #92
Conversation
case cls: Trait => | ||
defaultServiceExtras(cls.name, cls) | ||
case _ => | ||
abort(s"$invalid. $abstractOnly") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a better error here since @free isn't required anymore
|
||
val (algName, template) = defn match { | ||
lazy val (algName, template) = defn match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these all need to be lazy
.
val call: Term.Tuple = streamingType match { | ||
case Some(RequestStreaming) => | ||
q""" | ||
def call(callType: Option[String]): Term.Tuple = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing an Option[String]
for the callType is kind of a weird way to determine which call to use - unaryMethod
/unaryMethodFree
.
|
||
case class ServiceAlg(defn: Defn) extends RPCService { | ||
val typeParam: Type.Param = defn match { | ||
case c: Class => c.tparams.head |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.head
Codecov Report
@@ Coverage Diff @@
## master #92 +/- ##
=========================================
- Coverage 85.71% 85.6% -0.12%
=========================================
Files 12 12
Lines 126 125 -1
=========================================
- Hits 108 107 -1
Misses 18 18
Continue to review full report at Codecov.
|
This is great. I'll look at it tomorrow, thanks @tbrown1979! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @tbrown1979. This is a great step forward. RPC services didn't need to be encapsulated in @free
because the Handlers they provide can already be implemented in terms of Free
programs if the target M[_]
is a FreeS[Op, ?]
so the extra level of indirection was not buying us anything in the protocol algebra.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me, outstanding job! Thanks @tbrown1979
This PR drops the
@free
annotation and replaces it with@tagless
. This PR also removes the requirement that a@service
be annotated with@tagless
. You are free to define it with your own parameterized type if you want.This resulted in some changes to the generated code because we're no longer converting from
Op ~> M
anymore.