@@ -54,9 +54,9 @@ is used to literally bind two different containers together.
54
54
...
55
55
56
56
result = Success(1 ).bind(may_fail)
57
- # => Will be equal to either Success[int] or Failure[str]
57
+ # => Either Success[int] or Failure[str]
58
58
59
- And we use :func: `.map <returns.primitives.container.Container.map> `
59
+ And we have :func: `.map <returns.primitives.container.Container.map> `
60
60
to use containers with regular functions.
61
61
62
62
.. code :: python
@@ -67,7 +67,9 @@ to use containers with regular functions.
67
67
return state * 2
68
68
69
69
result = Success(1 ).map(double)
70
- # => Will be equal to Success(2)
70
+ # => Success(2)
71
+ result.map(lambda state : state + 1 )
72
+ # => Success(3)
71
73
72
74
The same work with built-in functions as well:
73
75
@@ -148,7 +150,7 @@ during the pipeline execution:
148
150
return state * 2.0
149
151
150
152
Failure(1 ).fix(double)
151
- # => Will be equal to Success(2.0)
153
+ # => Success(2.0)
152
154
153
155
``rescue `` should return one of ``Success `` or ``Failure `` types.
154
156
It can also rescue your flow and get on the successful track again:
@@ -201,6 +203,7 @@ inner state of containers into a regular types:
201
203
# => Traceback (most recent call last): UnwrapFailedError
202
204
203
205
The most user-friendly way to use ``unwrap `` method is with :ref: `pipeline `.
206
+ We even discourage using ``.unwrap() `` without a ``@pipeline ``.
204
207
205
208
For failing containers you can
206
209
use :func: `.failure <returns.primitives.container.FixableContainer.failure> `
0 commit comments