`arrow.syntax.tuples.plus` -> `Tuple2.monoid()....
# arrow
p
arrow.syntax.tuples.plus
->
Tuple2.monoid().run { t1 + t2 }
j
Thank you for suggestion. I tried the following:
Copy code
val a1 = 1 toT "one"
        val val1 = "1. one"
        val a2: Tuple3<Int, String, String> = Tuple2.monad().run { a1 + val1 }
and got the following compilation error. Error:(27, 54) Kotlin: Type inference failed: Not enough information to infer parameter F in fun <F> Tuple2.Companion.monad(MF: Monoid<F>, dummy: Unit = ...): Tuple2MonadInstance<F> Please specify it explicitly. Thank you in advance for further explanations
p
val val1 = "1. one"
that’s not a tuple
in any case, it’s monoid, a different typeclass
j
Thank you very much for the hints. One thing that one of the Functional Kotlin book authors emphasised in the book (amongst many other things), was the arrow.syntax.tuples.plus operator fun. Its signature more or less was like:
Copy code
operator fun Tuple2<A,B>.plus(c: C): Tuple3<A,B,C> {...}
This is not important for my project, I’ve just put in in a test when I read the book, and when I bump the arrow version to 0.7.0, I noticed it went away, and code didn’t compile any longer. And I was wondering if: 1. it was moved in another package (arrow lib). 2. it didn’t comply with the FP and was removed all together. Kind regards,
p
We have lost it in one of the latest versions, I don't think for any good reason. Can you please open a ticket so we don't forget to add it back?
j
Sure, Thank you very much for your good hints and support. Best regards.
👍 1