What types in Scala implement flatMap?

What types in core scala library implement flatMap? I've seen it in Option and collections. Any other?

Answers


In short: all types which are monadic.

flatMap is such a common operation that there are a lot of types which can implement it. There are mainly two sort of types which implement it: containers and types which are useful to be sequenced. A small overview over some types:

The first category contains

The second category contains

A useful way to find out all method names called flatMap is to open Scaladoc on letter F (below the search bar). Then search for flatMap with your browser and you will find all types containing the method.


Need Your Help

swift segue undeclared type breaks the code

ios swift segue

I have been searching every where for a solution but i can't find it and when i look at my code and others it looks as it should be looking.

How is StringBuffer implementing append function without creating two objects?

java string stringbuilder

It was an interview question. I was asked to implement the StringBuffer append function. I saw the code after the interview. But I cannot understand how the operation is done with creation of a sin...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.