-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feat/Result.match #108
Feat/Result.match #108
Conversation
packages/rx/src/Result.ts
Outdated
* @category combinators | ||
*/ | ||
export const match: { | ||
<A, E, Ret>(options: MatchOptions<A, E, Ret>): (self: Result<A, E>) => Ret |
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.
I think inlining the options is ok.
options: {
readonly onInitial: (_: Initial<A, E>) => X
readonly onFailure: (_: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}
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.
How do you mean? Instead of having a MatchOptions interface? It's used in multiple places though. What about just not exporting it?
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.
Similar to how .match is usually implemented in the effect
modules: https://effect-ts.github.io/effect/effect/Either.ts.html#match
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 just means the type signature is more obvious at a glance, instead of having to jump to the interface to see all the options.
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.
Ah gotcha. Makes sense. Updated :)
131dd71
to
1834e6d
Compare
1834e6d
to
c83595d
Compare
Added Result.match helper and ran docgen.