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 >>> def bindable(string: str) -> IO[str]: ... return IO(string
(
self,
function: Callable[[_ValueType_co], Kind1['IO', _NewValueType]],
)
| 128 | return self.map(dekind(container)._inner_value) # noqa: SLF001 |
| 129 | |
| 130 | def bind( |
| 131 | self, |
| 132 | function: Callable[[_ValueType_co], Kind1['IO', _NewValueType]], |
| 133 | ) -> 'IO[_NewValueType]': |
| 134 | """ |
| 135 | Applies 'function' to the result of a previous calculation. |
| 136 | |
| 137 | 'function' should accept a single "normal" (non-container) argument |
| 138 | and return ``IO`` type object. |
| 139 | |
| 140 | .. code:: python |
| 141 | |
| 142 | >>> def bindable(string: str) -> IO[str]: |
| 143 | ... return IO(string + 'b') |
| 144 | |
| 145 | >>> assert IO('a').bind(bindable) == IO('ab') |
| 146 | |
| 147 | """ |
| 148 | return dekind(function(self._inner_value)) |
| 149 | |
| 150 | #: Alias for `bind` method. Part of the `IOLikeN` interface. |
| 151 | bind_io = bind |
no test coverage detected