https://kotlinlang.org logo
Title
r

raulraja

11/16/2018, 10:34 PM
s

simon.vergauwen

11/19/2018, 10:16 AM
@raulraja this way the actual result is never in the kdocs, right?
Aren’t we better of writing samples like the following then.
Option.just(1).map { it + 1 } == Some(2)
. Something in test form.
r

raulraja

11/19/2018, 10:39 AM
If they are runnable the result doesn't show until you play
s

simon.vergauwen

11/19/2018, 10:39 AM
I meant in the Kdocs, not the arrow docs.
r

raulraja

11/19/2018, 10:39 AM
I see
You mean in the actual source?
s

simon.vergauwen

11/19/2018, 10:40 AM
Ye
r

raulraja

11/19/2018, 10:41 AM
Ank should print out the resulting value in the rendered doc but if you want the result when people are reading the sources then yeah
s

simon.vergauwen

11/19/2018, 10:41 AM
We could do something like
fun A.shouldEqual(other: A): Unit
that prints the result in runnable snippet but it showcases the result also in the actual code.
Just thinking out loud because a snippet like the following might not tell the user a lot (enough).
fun main(args: Array<String>) {
  listOf(1, 2, 3)
    .map { async { getUserById(it) } }
    .sequence(DeferredK.applicative())
}
Compared to
fun main(args: Array<String>) {
  listOf(1, 2, 3)
    .map { async { getUserById(it) } }
    .sequence(DeferredK.applicative()) shouldEqual
       async { listOf(User(1), User(2), User(3)) }
}
No need to jump to website and run snippet to clarify.
r

raulraja

11/19/2018, 12:16 PM
yes, but as a user I still want to go and modify those values
and see how the expression behaves with different values or code
if that comparison also uses
println
for the resulting value to get the best of both worlds then yeah
s

simon.vergauwen

11/19/2018, 12:17 PM
Ye that’s what I’d propose
r

raulraja

11/19/2018, 12:17 PM
👍 sounds great to me
sorry I read it backwards
yeah we were in agreement many msgs ago 😛
s

simon.vergauwen

11/19/2018, 12:18 PM
😄