-
Notifications
You must be signed in to change notification settings - Fork 621
Implement {Signal,SignallingRef}#mapK
#3546
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
|
@armanbilge Could you please review this and let me know if there are any mistakes that need correction? |
|
I think we can convert |
|
I'm encountering an issue while implementing the |
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.
Great, thanks, this looks good!
One final thing, can we add a test? Mostly I'm interested in a test to check that SignallingRef#mapK returns a SignallingRef instead of a Signal ... because we have two methods with the same name, I'm not entirely sure how they get resolved.
I think it is resolved as SignallingRef's mapK has an extra implicit parameter making it different from Signal’s mapK. |
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.
It does seem to be working!
I think it is resolved as SignallingRef's mapK has an extra implicit parameter making it different from Signal’s mapK.
That's right, they are different. I am just not sure how the compiler decides which method to choose when it's ambiguous.
Co-authored-by: Arman Bilge <armanbilge@gmail.com>
Co-authored-by: Arman Bilge <armanbilge@gmail.com>
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.
nice work, thank you!
{Signal,SignallingRef}#mapK
Previously, calling .mapK on a SignallingRef[F, A] would yield a plain Ref[G, A], causing the extra signaling behavior (such as discrete, continuous) to be lost. This PR introduces a new helper class, TransformedSignallingRef, which implements mapK for SignallingRef so that all signal-specific operations are lifted to the new effect type. This change ensures that after a transformation, the resulting reference remains a full SignallingRef[G, A] with its intended functionality.