Skip to content

fix: Layer.using + add test for a failing case#1423

Open
ahoy-jon wants to merge 13 commits intomainfrom
fix/layer
Open

fix: Layer.using + add test for a failing case#1423
ahoy-jon wants to merge 13 commits intomainfrom
fix/layer

Conversation

@ahoy-jon
Copy link
Collaborator

No description provided.

@ahoy-jon ahoy-jon requested a review from hearnadam September 21, 2025 12:42
Comment on lines +320 to +321
case FromKyo(kyo) => kyo()
case FromKyo_0(kyo) => kyo()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these will be materialized to the same expected type - I don't think we need a distinct variant. Can we keep it as just FromKyo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be nice, but Env[Nothing] will not be helpful.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just cast. There's no difference in the underlying representation due to type widening.

- Updated `andTo` method implementation to use a more consistent syntax.
- Replaced deprecated `using` method with a direct call to `andTo`.
- Removed unused `AndTo` case class from the `Layer` object.
- Adjusted test cases to reflect the changes in method usage.
- Changed references of `andTo` to `using` in the documentation.
- Updated example code to reflect the new method name and its usage.
- Ensured consistency in method descriptions for better understanding.
final infix def using[Out2, S2, In2](that: Layer[Out2, Env[In2] & S2]): Layer[Out & Out2, S & S2] = self and (self to that)
final infix def andTo[Out2, S2](that: Layer[Out2, Env[Out] & S2]): Layer[Out & Out2, S & S2] = self and (self to that)

final infix def using[Out2, S2](that: Layer[Out2, Env[Out] & S2]): Layer[Out & Out2, S & S2] = self andTo that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deprecated?

Comment on lines +320 to +321
case FromKyo(kyo) => kyo()
case FromKyo_0(kyo) => kyo()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just cast. There's no difference in the underlying representation due to type widening.

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.

3 participants