FlatMap’s One-Night Stand with Map
When Scala containers slip into something more comfortable and lose a layer
The combinator map
keeps the shape of a container while flatMap
applies a transformation that may introduce another layer and then collapses the result. What many newcomers to Scala do not notice is …