Skip to content

Commit

Permalink
rename Result.matchRefined to matchWithError
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jun 6, 2024
1 parent 02c2bea commit af598a2
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .changeset/new-adults-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect-rx/rx": patch
---

rename Result.matchRefined to matchWithError
54 changes: 54 additions & 0 deletions docs/rx/Result.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Added in v1.0.0
- [combinators](#combinators)
- [map](#map)
- [match](#match)
- [matchWithError](#matchwitherror)
- [matchWithWaiting](#matchwithwaiting)
- [toExit](#toexit)
- [constructors](#constructors)
- [fail](#fail)
Expand Down Expand Up @@ -128,6 +130,58 @@ export declare const match: {
Added in v1.0.0
## matchWithError
**Signature**
```ts
export declare const matchWithError: {
<A, E, W, X, Y, Z>(options: {
readonly onInitial: (_: Initial<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): (self: Result<A, E>) => W | X | Y | Z
<A, E, W, X, Y, Z>(
self: Result<A, E>,
options: {
readonly onInitial: (_: Initial<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}
): W | X | Y | Z
}
```
Added in v1.0.0
## matchWithWaiting
**Signature**
```ts
export declare const matchWithWaiting: {
<A, E, W, X, Y, Z>(options: {
readonly onWaiting: (_: Result<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): (self: Result<A, E>) => W | X | Y | Z
<A, E, W, X, Y, Z>(
self: Result<A, E>,
options: {
readonly onWaiting: (_: Result<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}
): W | X | Y | Z
}
```
Added in v1.0.0
## toExit
**Signature**
Expand Down
52 changes: 26 additions & 26 deletions packages/rx/src/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,25 +359,25 @@ export const match: {
* @since 1.0.0
* @category combinators
*/
export const matchRefined: {
<A, E, X, Y, Z>(options: {
readonly onInitial: (_: Initial<A, E>) => X
readonly onError: (error: E, _: Failure<A, E>) => Y
export const matchWithError: {
<A, E, W, X, Y, Z>(options: {
readonly onInitial: (_: Initial<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): (self: Result<A, E>) => X | Y | Z
<A, E, X, Y, Z>(self: Result<A, E>, options: {
readonly onInitial: (_: Initial<A, E>) => X
readonly onError: (error: E, _: Failure<A, E>) => Y
}): (self: Result<A, E>) => W | X | Y | Z
<A, E, W, X, Y, Z>(self: Result<A, E>, options: {
readonly onInitial: (_: Initial<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): X | Y | Z
} = dual(2, <A, E, X, Y, Z>(self: Result<A, E>, options: {
readonly onInitial: (_: Initial<A, E>) => X
readonly onError: (error: E, _: Failure<A, E>) => Y
}): W | X | Y | Z
} = dual(2, <A, E, W, X, Y, Z>(self: Result<A, E>, options: {
readonly onInitial: (_: Initial<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): X | Y | Z => {
}): W | X | Y | Z => {
switch (self._tag) {
case "Initial":
return options.onInitial(self)
Expand All @@ -397,25 +397,25 @@ export const matchRefined: {
* @since 1.0.0
* @category combinators
*/
export const matchRefinedWaiting: {
<A, E, X, Y, Z>(options: {
readonly onWaiting: (_: Result<A, E>) => X
readonly onError: (error: E, _: Failure<A, E>) => Y
export const matchWithWaiting: {
<A, E, W, X, Y, Z>(options: {
readonly onWaiting: (_: Result<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): (self: Result<A, E>) => X | Y | Z
<A, E, X, Y, Z>(self: Result<A, E>, options: {
readonly onWaiting: (_: Result<A, E>) => X
readonly onError: (error: E, _: Failure<A, E>) => Y
}): (self: Result<A, E>) => W | X | Y | Z
<A, E, W, X, Y, Z>(self: Result<A, E>, options: {
readonly onWaiting: (_: Result<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): X | Y | Z
} = dual(2, <A, E, X, Y, Z>(self: Result<A, E>, options: {
readonly onWaiting: (_: Result<A, E>) => X
readonly onError: (error: E, _: Failure<A, E>) => Y
}): W | X | Y | Z
} = dual(2, <A, E, W, X, Y, Z>(self: Result<A, E>, options: {
readonly onWaiting: (_: Result<A, E>) => W
readonly onError: (error: E, _: Failure<A, E>) => X
readonly onDefect: (defect: unknown, _: Failure<A, E>) => Y
readonly onSuccess: (_: Success<A, E>) => Z
}): X | Y | Z => {
}): W | X | Y | Z => {
if (self.waiting) {
return options.onWaiting(self)
}
Expand Down

0 comments on commit af598a2

Please sign in to comment.