-
Notifications
You must be signed in to change notification settings - Fork 523
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
Add default constructor for MapRef
#4139
Conversation
a327788
to
c97fd33
Compare
c97fd33
to
9492471
Compare
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.
While this alone is great.
We may also request a default value in apply
to improve UX as suggested by @Jasper-M
update type check to Sync and address feedback
5d529b2
to
438eabb
Compare
I have added an overloaded apply . WDYT |
Sadly I don't think that would work well: https://scastie.scala-lang.org/BalmungSan/WHoq2ShkTCm3QSs5puHixw I think the best would be to do what Arman suggested and rather add a val m1 = MapRef[IO, K, V] // Returns MapRef[IO, K, Option[V]
val m2 = m1.withDefault(foo) // Returns MapRef[IO, K, V] |
I see, it fails for certain types. |
MapRef
Co-authored-by: Arman Bilge <[email protected]>
Co-authored-by: Arman Bilge <[email protected]>
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.
thanks!
Adds an apply method for MapRef. If the Effect type is an instance of Async , the
ConcurrentHashMap
implementation will be used otherwise thesharedImmutableMap
will be used with the number of shards set to the number of Processors determined byRuntime.getRuntime.availableProcessors
.The goal of this MR is to improve the UX for a user by having a sane default
closes #4136
P.S. as this is a first-time PR to this repo, please let me know if there are any conventions/practices, etc.. that I should be adhering to. TY