4 ms·
A function has ONE parameter and ONE return value. The trick is that these parameters and returned values may be tuples or functions themselves. So we can hav
by dwenzek 11y ago
A function has ONE parameter and ONE return value.
The trick is that these parameters and returned values
may be tuples or functions themselves.
So we can have a function which takes a single parameter which is a tuple :
function_name :: (Param1Type, Param2Type) -> ReturnType
Or we can have a function which takes a single parameter and returns another function:
function_name :: Param1Type -> (Param2Type -> ReturnType)
Using implied operator precedence, the later is written:
function_name :: Param1Type -> Param2Type -> ReturnType
And has to be distinguished from a function which takes a function as parameter:
function_name :: (Param1Type -> Param2Type) -> ReturnType