abendt
10/20/2019, 2:44 PMList(List(1), List(2, 3)).flatten should be(
List(1,2,3)
)
my Kotlin/Arrow version looks like this (part of a KotlinTest):
import arrow.core.extensions.list.monad.flatten
...
"flatten" {
listOf(listOf(1), listOf(2, 3)).flatten() shouldBe listOf(1, 2, 3)
}
However this causes an StackOverflowError:
java.lang.StackOverflowError
at arrow.core.extensions.list.monad.ListKMonadKt.flatten(ListKMonad.kt:76)
at arrow.core.extensions.list.monad.ListKMonadKt.flatten(ListKMonad.kt:76)
at arrow.core.extensions.list.monad.ListKMonadKt.flatten(ListKMonad.kt:76)
When i use the flatten() extension function from the kotlin stdlib my test works. This made me wonder wether this might be an issue within arrow or if i am misusing arrow here.
thanks in advance, Alphonse