Why is there only 1 type parameter in scala list flatmap parameter signature -


why flatmap list takes b type parameter

def flatmap[b](f: (a) => u[b]): u[b] 

instead of

def flatmap[a, b](f: (a) => u[b]): u[b] 

because a deduced type parameter defined on list:

sealed abstract class list[+a] 

and since flatmap defined each element of type a in list, there's no need explicitly declare it.


Comments

Popular posts from this blog

How to use SUM() in MySQL for calculated values -

ios - IBOutlet for image button not correctly referencing button after recreating outlet -

java - AEM: 403 Forbidden occurs when call a Post servlet -