-
Notifications
You must be signed in to change notification settings - Fork 451
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
Resource parZip & fromAutoCloseable #2452
Conversation
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 @nomisRev !
public fun <B, C> parZip(fb: Resource<B>, f: (A, B) -> C): Resource<C> = | ||
parZip(Dispatchers.Default, fb, f) | ||
|
||
/** |
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.
Perhaps we should add similar comments with examples to other members in the data type that are public https://arrow-kt.io/docs/apidocs/arrow-fx-coroutines/arrow.fx.coroutines/-resource/map.html
public fun <A : Closeable> Resource.Companion.fromCloseable(f: suspend () -> A): Resource<A> = | ||
Resource(f) { s, _ -> withContext(Dispatchers.IO) { s.close() } } | ||
|
||
@Deprecated("Typo in the function name, use fromCloseable instead.", ReplaceWith("Resource.fromCloseable(f)")) | ||
public fun <A : Closeable> Resource.Companion.fromClosable(f: suspend () -> A): Resource<A> = |
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.
😅 Good eyes you have !!
Thanks👍🏾
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 @nomisRev
* fix docs * Add Resourc parZip * Uncomment test, and remove deprecated usage * Fix JS CancellationException ambiguity * Replace shouldThrow with assertThrowable for JS runtime.
This PR adds:
Resource
parZip
. This will allows for encodingparZip
toarity-9, add
parTraverseResource` etc.AutoCloseable
, which was missing next toCloseable
.map
operator to supportsuspend
and addstap
combinator.