I came across following type of function declaration:
def fun(): Int => Int => Int = { ..... }
How to interpret the type of function fun?
Which one of the following two interpretations it indicates?
First interpretation: fun is a function returning some function X which accepts another function Y as a parameter. This function Y accepts one integer and returns one integer ; and ultimately the function X returns an integer.
def fun(): (Int => Int) => Int = { ..... }
Second interpretation: fun is a function returning some function X which accepts an integer as a parameter and returns another function Y. This function Y accepts an integer and returns an integer.
def fun(): Int => (Int => Int) = { ..... }
So which one of these interpretations apply in this case?
funis a method, not a function. So,funis a method with one empty parameter list which returns a function that takes anIntwhich returns a function that takes anIntand returns anInt.