<@U6M6DATB5> Node can support flatMap and you don'...
# codereview
r
@arekolek Node can support flatMap and you don't need to rely in intermediate collection representations if what you have there is a Tree. It can also be generically presented to encode any
A
inside. for example this one in Scala is a Tree with a flatMap impl a bit more involved of what you are doing https://github.com/scalaz/scalaz/blob/scalaz-seven/core/src/main/scala/scalaz/Tree.scala , but the idea is that you can define
flatMap
in many datatypes not just collections. flatten is flatMap over the identity function https://github.com/kategory/kategory/blob/master/kategory/src/main/kotlin/kategory/typeclasses/Monad.kt#L19 . Not suggesting you change anything in your impl just some info in case you are curious about the nature of those flatMap/flatten operations.