MCPcopy Index your code
hub / github.com/dry-python/returns / alt

Method alt

returns/io.py:522–535  ·  view source on GitHub ↗

Composes failed container with a pure function to modify failure. .. code:: python >>> from returns.io import IOFailure >>> assert IOFailure(1).alt(float) == IOFailure(1.0)

(
        self,
        function: Callable[[_ErrorType_co], _NewErrorType],
    )

Source from the content-addressed store, hash-verified

520 """
521
522 def alt(
523 self,
524 function: Callable[[_ErrorType_co], _NewErrorType],
525 ) -> 'IOResult[_ValueType_co, _NewErrorType]':
526 """
527 Composes failed container with a pure function to modify failure.
528
529 .. code:: python
530
531 >>> from returns.io import IOFailure
532 >>> assert IOFailure(1).alt(float) == IOFailure(1.0)
533
534 """
535 return self.from_result(self._inner_value.alt(function))
536
537 def lash(
538 self,

Callers

nothing calls this directly

Calls 1

from_resultMethod · 0.95

Tested by

no test coverage detected