-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ZIO Core: Add Named Aliases for ZLayer Operators #3116
Conversation
/** | ||
* A named alias for `>>>`. | ||
*/ | ||
def andThen[E1 >: E, ROut2](that: ZLayer[ROut, E1, ROut2]): ZLayer[RIn, E1, ROut2] = |
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.
How about injectInto
or injectTo
?
/** | ||
* A named alias for `++`. | ||
*/ | ||
def zip[E1 >: E, RIn2, ROut1 >: ROut, ROut2 <: Has[_]]( |
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.
How about and
or maybe combine
?
Clock.live and System.live and (HttpClient.live injectInto StorageAPI.live)
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.
Sure. We could also do to
for >>>
so they were both short.
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.
👍
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.
Done.
/** | ||
* A named alias for `++`. | ||
*/ | ||
def and[E1 >: E, RIn2, ROut1 >: ROut, ROut2 <: Has[_]]( |
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.
Not to delay further but I'm not sure they are alphabetized. I'll approve though!
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 think they are but and
just appears far down in the file because it is in the syntax class that provides evidence that the output type is a subtype of Has[_]
.
@adamgfraser @jdegoes just found this PR because I was looking through the recent source code changes and was going to suggest that Honestly even Given a choice between
|
@adamgfraser @jdegoes I could potentially see |
@HansBrende As you say, I think the idea of We also still have So I guess my initial thought would be we picked a name for this and move on but if we wanted to revisit we could change to |
Works for me, just thought I'd throw out my 2 cents in case it sparked something. :) |
Appreciate you sharing your thoughts! If other people like |
That actually brings up a completely unrelated question I have for you. I keep finding myself using the following pattern:
in order to get an |
@HansBrende We just added a The thing to think through there is whether you want to expose the The default with layers is that dependencies aren't passed through but you can use |
Adds
andThen
as named alias for>>>
andzip
as named alias for++
.