Skip to content

Commit 3ea3b26

Browse files
authored
Remove match statement (#103)
* Remove match statement. Fixes #102 * Use map instead
1 parent 19637ad commit 3ea3b26

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

expression/core/result.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,7 @@ def map2(
195195
other: Ok[_TOther, _TError] | Error[_TOther, _TError],
196196
mapper: Callable[[_TSource, _TOther], _TResult],
197197
) -> Result[_TResult, _TError]:
198-
# assert isinstance(other, (Ok, Error))
199-
match other:
200-
case Ok(value):
201-
return Ok(mapper(self._value, value))
202-
case Error(error):
203-
return Error(error)
198+
return other.map(lambda value: mapper(self._value, value))
204199

205200
def bind(
206201
self, mapper: Callable[[_TSource], Result[_TResult, _TError]]

0 commit comments

Comments
 (0)