https://kotlinlang.org logo
#arrow
Title
# arrow
j

Jun Sekine

03/27/2023, 10:26 PM
hello. I am trying to implementing for this issue I requested. https://github.com/arrow-kt/arrow/issues/3001 The commit is on this forked branch https://github.com/jsoizo/arrow/commit/0211696e092c8c25eca4a995df2831b0ffcd5768 However,
./gradlew knit
generates unnecessary codes as below, and they are removed manually when committing. could you help this problems?
Copy code
import arrow.core.*

fun test() {
  val original: List<String> = listOf("Hello", ",", "World")
  val result: Iterable<CharSequence> = original.widen()
}

import arrow.core.*

fun main() {
  val original: List<String> = listOf("Hello", ",", "World")
  val result: Iterable<CharSequence> = original.widen()
}
y

Youssef Shoaib [MOD]

03/28/2023, 12:21 AM
Not sure about the knit issue, but for you implementation, would it not be more efficient to use 2 `MutableList`s and iterate and add to each, and then, and only then, make a pair and return it?
Figured out the knit issue. You need to move your function so that it is above the two
widen
functions. That's because knit merges together code blocks that don't belong to a file yet. You could also have the widen functions have their own knit files. I can make a pr with that if you want
I've made a pull request on your repo with the fix for the knit issue and a more-efficient implementation for
partitionMap
s

simon.vergauwen

03/28/2023, 6:51 AM
This implementation actually already exists, https://github.com/jsoizo/arrow/pull/1/files#diff-47d18db48a86e0ca0b3da1ea9d184df8534c1dccfaf4736121e9ccaf6bf7f4cdR1158. It should just be parameterised with a lambda, and overloaded with
::identity
to recreate the existing function.
14 Views