https://kotlinlang.org logo
#announcements
Title
# announcements
p

pakoito

05/20/2017, 1:41 AM
fun <G : Applicative<*>, A, B> traverse(fa: HK<F, A>): (f: (A) -> HK<G, B>) -> HK<G, HK<F, B>>
is this valid syntax? that f name looks out of place, yet it compiles
k

kiku

05/20/2017, 8:57 AM
It should be valid. for a function declaration, it goes
"fun" ... ":" type
, where
type
then is
modifier typeReference
, where in your case
typeReference
matches
functionType
, where the
"("parameter{","}?")"
has the
parameter
simply matching
SimpleName : type
. So the
f
in which case would be the
SimpleName
Although I am not very sure of what the significance of this type name is
p

pakoito

05/20/2017, 10:52 AM
Yes, being at type position. It’s a weird looking currying. Thanks!
🙂 1
2 Views