|
|
|
|
|
by atombender
2443 days ago
|
|
Having -> denote a return variable has the benefit that you the syntax "a -> b" is non-ambiguously a function type. For example, a function that accepts a function as an argument can be written: fn foo(f: int -> string)
Or if the argument name isn't needed in this context (e.g. think interface declarations): fn foo(int -> string)
If you see ":" as meaning "has type", then using it for a return type isn't necessarily more consistent, because it's not the function that has a type. |
|
add :: (int, int) -> int