I wonder, you say that flatMap
is monad's bind
method. The bind method takes a function that maps monad's contained item to another monad. This is how
option.flatMap(item => another option (f(item)))
gives me another monad with f(item)
inside. But, what does it mean applied to List? By strightforward extension, if you map every List item to a (list) monad, you get the whole list of lists. Why does bind
flatten the outcome when applied to the list?