Xuc Xiem
06/05/2020, 1:55 AM.k()
as much as possible in the following example:
val m = mapOf("a" to listOf(1, 2).k(), "b" to listOf(3).k()).k()
val n = mapOf("a" to listOf(4).k(), "c" to listOf(5, 6).k()).k()
val p = MapK.semigroup<String, ListK<Int>>(ListK.semigroup()).run { m + n }
aballano
06/05/2020, 9:18 AM.k()
? I believe it should workaballano
06/05/2020, 9:57 AMpakoito
06/05/2020, 9:58 AM+
for maps in the standard library doesn't add the values togetherpakoito
06/05/2020, 9:58 AMaballano
06/05/2020, 10:03 AM.k()
but not for plain list and a Map. Ideally this should work
val m = mapOf("a" to listOf(1, 2), "b" to listOf(3))
val n = mapOf("a" to listOf(4), "c" to listOf(5, 6))
val p = Map.semigroup<String, List<Int>>(List.semigroup()).run { m.combine(n) }
but it seems there’s no Semigroup generated for map although it exists for list 🤔aballano
06/05/2020, 10:03 AMXuc Xiem
06/05/2020, 10:36 AMimport <http://arrow.xxx|arrow.xxx>
when you use standard kotlin map
, list
and combine
? My IntelliJ suggested import arrow.core.extensions.list.semigroup.List.semigroup
but there's still compilation error.aballano
06/05/2020, 11:02 AMaballano
06/05/2020, 11:31 AMXuc Xiem
06/05/2020, 11:34 AM