Skip to content

Commit d5ab1f7

Browse files
Removed (almost) all Try examples in documentation/comment blocks (#69)
* Remove Try from fx in documentation/comment blocks Co-authored-by: Alberto Ballano <[email protected]>
1 parent 72c55f2 commit d5ab1f7

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

arrow-libs/fx/arrow-docs/docs/fx/polymorphism/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ fun main() {
8585
}
8686
```
8787

88-
*Fx over `Try`*
88+
*Fx over `Either`*
8989
```kotlin:ank:playground
90-
import arrow.core.Try
90+
import arrow.core.Either
9191
import arrow.core.extensions.fx
9292
9393
//sampleStart
9494
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)
9898
two
9999
}
100100
//sampleEnd

arrow-libs/fx/arrow-docs/docs/integrations/reactor/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ fun main() {
154154
```
155155

156156
```kotlin:ank:fail
157-
import arrow.core.Try
157+
import arrow.fx.IO
158158
159159
// This will result in a stack overflow
160-
Try {
160+
IO {
161161
MonoK.monad().fx.monad {
162162
(1..50000).fold(just(0)) { acc: Kind<ForMonoK, Int>, x: Int ->
163163
just(acc.bind() + 1)
164164
}.bind()
165165
}.fix().mono.block()
166-
}
166+
}.attempt().unsafeRunSync()
167167
```

arrow-libs/fx/arrow-docs/docs/integrations/rx2/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,18 @@ fun main() {
217217
```
218218

219219
```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+
221225
// This will result in a stack overflow
222226
223-
Try {
227+
IO {
224228
FlowableK.monad().fx.monad {
225229
(1..50000).fold(just(0)) { acc: Kind<ForFlowableK, Int>, x: Int ->
226230
just(acc.bind() + 1)
227231
}.bind()
228232
}.fix().flowable.blockingFirst()
229-
}
233+
}.attempt().unsafeRunSync()
230234
```

0 commit comments

Comments
 (0)