Applies 'function' to the result of a previous calculation. 'function' should accept a single "normal" (non-container) argument and return ``IO`` type object. .. code:: python >>> import anyio >>> from returns.future import Future >>>
(
self,
function: Callable[[_ValueType_co], IO[_NewValueType]],
)
| 316 | ) |
| 317 | |
| 318 | def bind_io( |
| 319 | self, |
| 320 | function: Callable[[_ValueType_co], IO[_NewValueType]], |
| 321 | ) -> 'Future[_NewValueType]': |
| 322 | """ |
| 323 | Applies 'function' to the result of a previous calculation. |
| 324 | |
| 325 | 'function' should accept a single "normal" (non-container) argument |
| 326 | and return ``IO`` type object. |
| 327 | |
| 328 | .. code:: python |
| 329 | |
| 330 | >>> import anyio |
| 331 | >>> from returns.future import Future |
| 332 | >>> from returns.io import IO |
| 333 | |
| 334 | >>> def bindable(x: int) -> IO[int]: |
| 335 | ... return IO(x + 1) |
| 336 | |
| 337 | >>> assert anyio.run( |
| 338 | ... Future.from_value(1).bind_io(bindable).awaitable, |
| 339 | ... ) == IO(2) |
| 340 | |
| 341 | """ |
| 342 | return Future(_future.async_bind_io(function, self._inner_value)) |
| 343 | |
| 344 | def __aiter__(self) -> AsyncIterator[_ValueType_co]: # noqa: WPS611 |
| 345 | """API for :ref:`do-notation`.""" |