Calls a wrapped function in a container on this container. .. code:: python >>> from returns.context import RequiresContext >>> assert RequiresContext.from_value('a').apply( ... RequiresContext.from_value(lambda inner: inner + 'b') ... )(
(
self,
container: Kind2[
RequiresContext,
Callable[[_ReturnType_co], _NewReturnType],
_EnvType_contra,
],
)
| 151 | return RequiresContext(lambda deps: function(self(deps))) |
| 152 | |
| 153 | def apply( |
| 154 | self, |
| 155 | container: Kind2[ |
| 156 | RequiresContext, |
| 157 | Callable[[_ReturnType_co], _NewReturnType], |
| 158 | _EnvType_contra, |
| 159 | ], |
| 160 | ) -> RequiresContext[_NewReturnType, _EnvType_contra]: |
| 161 | """ |
| 162 | Calls a wrapped function in a container on this container. |
| 163 | |
| 164 | .. code:: python |
| 165 | |
| 166 | >>> from returns.context import RequiresContext |
| 167 | >>> assert RequiresContext.from_value('a').apply( |
| 168 | ... RequiresContext.from_value(lambda inner: inner + 'b') |
| 169 | ... )(...) == 'ab' |
| 170 | |
| 171 | """ |
| 172 | return RequiresContext( |
| 173 | lambda deps: self.map(dekind(container)(deps))(deps), |
| 174 | ) |
| 175 | |
| 176 | def bind( |
| 177 | self, |
nothing calls this directly
no test coverage detected