Implement {Signal,SignallingRef}#mapK#3546
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.
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. |
armanbilge
left a comment
There was a problem hiding this comment.
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>
{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.