It’s just an iterable of iterables of `T` which ge...
# announcements
e
It’s just an iterable of iterables of
T
which gets flattened into a list of
T
. Here’s an example:
Copy code
[[1, 2, 3], [4], [5, 6]] -> flatten -> [1, 2, 3, 4, 5, 6]
i
I thought it was like a recursive type, it seems I was wrong, so I wonder can we do that MapTree on kotlin? data Tree a = Leaf a | Node (Tree a) (Tree a) deriving (Show)
s
It is indeed a recursive generic type but you’re not going to be able to do anything particularly Haskell-ey with them
i
@Shawn aha, why?
d
You can do @Ifvwm
Copy code
sealed class Tree<T> {
    class Leaf<T>(val value: T) : Tree<T>() 
    class Node<T>(val left: Tree<T>, val right: Tree<T>) : Tree<T>()
}