-
Couldn't load subscription status.
- Fork 1.4k
Explore Initial Encoding of ZLayer #3483
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
Conversation
|
Very nice. The algebra here is quite small so no downside in the size of the interpreter, and ZLayer usually won't be on the hot path of most applications. Looks like a pretty good tradeoff for being able to introspect the dependency graph. |
Yes, although if you add unwrap, it could be another term: it just means in some cases (where
I think you're right. Maybe something like ZIO Test: myLayer ?? "Postgres product db"
👍 Big 👍 on this from me. This is going to be very useful and will also allow us more power with optimization. As for |
|
Implemented |
|
@adamgfraser Superb! |
|
@jdegoes Great! Will pursue the rendering in a follow up PR. |
Explores moving to an initial encoding of
ZLayerto allow more static analysis of the dependency graph. It goes to an algebraic data type as follows:Everything is working except I don't think we can support the
unwrapmethod with this encoding, at least if we want to retain any ability to do static analysis of what is inside the, and we have to think about the meaning of thefreshcombinator.I added a
sizemethod to demonstrate the ability to do some static analysis. I think we may want to consider including some type of identifier in layers. It seems like one of the more useful things we could do here is render the dependency graph. Right now we can capture the high level structure but don't really have any meaningful values to label the nodes of the dependency graph with.