https://kotlinlang.org logo
Title
b

bitnot

05/23/2020, 7:49 PM
Hey there! Could someone point me to some docs explaining why
val (_) = Unpackable("Two")
does not call
component1
?
b

bitnot

05/23/2020, 8:01 PM
Thank you, @Milan Hruban, somehow I missed the
The componentN() operator functions are not called for the components that are skipped in this way.
part…
👍 1
m

Milan Hruban

05/23/2020, 9:23 PM
wouldn't make sense to call them, if we don't want the value 🙂
b

bitnot

05/24/2020, 11:45 AM
Well, when it has a hidden effect of updating the state in for-comprehension, it’s just a bit surprising. 😄 Took me a bit to realize it was a Kotlin thing and not an Arrow thing. https://github.com/bitnot/fpinkotlin/blob/practice/src/test/kotlin/chapter6/exercises/Exercise_6_11.kt#L89
e

elizarov

05/25/2020, 8:37 AM
component1
with a side-effect 😱 My life will never be the same
😄 2
b

bitnot

05/25/2020, 8:11 PM
my bad, poor explanation. to be precise,
component1
is overloaded to call monad extension function
bind
that calls
suspendCoroutineUninterceptedOrReturn
😉 https://github.com/arrow-kt/arrow-core/blob/master/arrow-core-data/src/main/kotlin/arrow/typeclasses/MonadContinuations.kt#L31