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

Method map

returns/io.py:389–402  ·  view source on GitHub ↗

Composes successful container with a pure function. .. code:: python >>> from returns.io import IOSuccess >>> assert IOSuccess(1).map(lambda num: num + 1) == IOSuccess(2)

(
        self,
        function: Callable[[_ValueType_co], _NewValueType],
    )

Source from the content-addressed store, hash-verified

387 return self.from_result(self._inner_value.swap())
388
389 def map(
390 self,
391 function: Callable[[_ValueType_co], _NewValueType],
392 ) -> 'IOResult[_NewValueType, _ErrorType_co]':
393 """
394 Composes successful container with a pure function.
395
396 .. code:: python
397
398 >>> from returns.io import IOSuccess
399 >>> assert IOSuccess(1).map(lambda num: num + 1) == IOSuccess(2)
400
401 """
402 return self.from_result(self._inner_value.map(function))
403
404 def apply(
405 self,

Callers

nothing calls this directly

Calls 2

from_resultMethod · 0.95
mapMethod · 0.45

Tested by

no test coverage detected