Why flatMapfor Listaccepts only Bas a type parameter
flatMap
List
B
def flatMap[B](f: (A) => U[B]): U[B]
instead
def flatMap[A, B](f: (A) => U[B]): U[B]
Because it Ais inferred from a type parameter defined in List:
A
sealed abstract class List[+A]
And since it is flatMapdefined for each element of type Ab List, there is no need to explicitly declare it.
Scala - - . - ( , , Python) , , , this self. , :
this
self
, .
flatMap List[+A], , , :
List[+A]
def flatMap[A, B](me: List[A])(f: (A) => U[B]): U[B]
Source: https://habr.com/ru/post/1652825/More articles:changing React.js form values with chrome extension - javascriptHow to remove html files from Firebase Hosting? - firebaseJSPM does not load HTML files - htmlwepback 2 hot reload not rerender - javascripthow to get to another container from docked nginx - dockerDatabase cache configuration codeigniter - databaseMysql query issue with connection and filter - databaseКак компании мобильной связи обнаруживают, что вы используете интернет-соединение 3G/4G? - mobileОператор '==' не может применяться к группе методов операндов 'или' string ' - c#Border with a color gradient to the left, top, bottom and right - cssAll Articles