Commit d5ab1f7 1 parent 72c55f2 commit d5ab1f7 Copy full SHA for d5ab1f7
File tree 3 files changed +15
-11
lines changed
arrow-libs/fx/arrow-docs/docs
3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -85,16 +85,16 @@ fun main() {
85
85
}
86
86
```
87
87
88
- * Fx over ` Try ` *
88
+ * Fx over ` Either ` *
89
89
``` kotlin:ank:playground
90
- import arrow.core.Try
90
+ import arrow.core.Either
91
91
import arrow.core.extensions.fx
92
92
93
93
//sampleStart
94
94
val result =
95
- Try .fx {
96
- val (one) = Try { 1 }
97
- val (two) = Try { one + one }
95
+ Either .fx<Throwable, Int> {
96
+ val (one) = Either.right(1)
97
+ val (two) = Either.right( one + one)
98
98
two
99
99
}
100
100
//sampleEnd
Original file line number Diff line number Diff line change @@ -154,14 +154,14 @@ fun main() {
154
154
```
155
155
156
156
``` kotlin:ank:fail
157
- import arrow.core.Try
157
+ import arrow.fx.IO
158
158
159
159
// This will result in a stack overflow
160
- Try {
160
+ IO {
161
161
MonoK.monad().fx.monad {
162
162
(1..50000).fold(just(0)) { acc: Kind<ForMonoK, Int>, x: Int ->
163
163
just(acc.bind() + 1)
164
164
}.bind()
165
165
}.fix().mono.block()
166
- }
166
+ }.attempt().unsafeRunSync()
167
167
```
Original file line number Diff line number Diff line change @@ -217,14 +217,18 @@ fun main() {
217
217
```
218
218
219
219
``` kotlin:ank:fail
220
- import arrow.core.Try
220
+ import arrow.Kind
221
+ import arrow.fx.IO
222
+ import arrow.fx.rx2.*
223
+ import arrow.fx.rx2.extensions.flowablek.monad.monad
224
+
221
225
// This will result in a stack overflow
222
226
223
- Try {
227
+ IO {
224
228
FlowableK.monad().fx.monad {
225
229
(1..50000).fold(just(0)) { acc: Kind<ForFlowableK, Int>, x: Int ->
226
230
just(acc.bind() + 1)
227
231
}.bind()
228
232
}.fix().flowable.blockingFirst()
229
- }
233
+ }.attempt().unsafeRunSync()
230
234
```
You can’t perform that action at this time.
0 commit comments