by atombender · 7y ago · 0 comments
let sum a b = a + b
...has the type: float -> float -> float
Same in Haskell.These languages "emulate" multiple arguments through partial function application. OCaml does not use tuples for arguments.
As far as the original sugestion, using '->' (arrow) to denote a return type (like Rust) is nonsense in a functional language and kind of butchering the functional inherited syntax IMHO.
> is nonsense in a functional language
SML/OCaml and Haskell all use ->, so I'm not sure what you mean by this?
[1] https://stackoverflow.com/questions/10666913/why-prefer-curr...
let add ((a:int), (b:int)) : int = a + b
Works just fine, whereas: let add ((a:int), (b:int)) -> int = a + b
is nonsense, because '->' is a type constructer in OCaml (a function from types to types) not part of an ad-hoc syntax for function declarations (like Rust).