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

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -