Skip to content

Commit

Permalink
Fix return types of and_then methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
MylesBartlett committed Jul 22, 2024
1 parent 11ddff0 commit 36a9255
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions serox/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def map_or_else[U](self: Option[T], default: Fn0[U], f: Fn1[T, U], /) -> U:
@overload
def and_then[U](self: Null[T], f: Fn1[T, U], /) -> Null[U]: ...
@overload
def and_then[U](self: Some[T], f: Fn1[T, U], /) -> U: ...
def and_then[U](self: Option[T], f: Fn1[T, U], /) -> U | Null[U]:
def and_then[U](self: Some[T], f: Fn1[T, U], /) -> Option[U]: ...
def and_then[U](self: Option[T], f: Callable[[T], Option[U]], /) -> Option[U]:
match self:
case Some(x):
return f(x)
Expand Down
4 changes: 2 additions & 2 deletions serox/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def err(self: Result[T, E]) -> Option[E]:
@overload
def and_then[U](self: Err[T, E], f: Fn1[T, U], /) -> Err[U, E]: ...
@overload
def and_then[U](self: Ok[T, E], f: Fn1[T, U], /) -> U: ...
def and_then[U](self: Result[T, E], op: Fn1[T, U], /) -> U | Err[U, E]:
def and_then[U](self: Ok[T, E], f: Fn1[T, U], /) -> Result[U, E]: ...
def and_then[U](self: Result[T, E], op: Callable[[T], Result[U, E]], /) -> Result[U, E]:
match self:
case Ok(t):
return op(t)
Expand Down

0 comments on commit 36a9255

Please sign in to comment.