The thing is how the parser extracts syntax parameters to avoid ambiguity.
+ is both a binary addition operator and a unary "positive" operator 1 . 5 + b is thus the application of a complement to two arguments; but +b is a positive operator applied to some character b .
In this way,
let ab ab = a 5 + b
analyzed as:
let ab ab = (a 5) + b
with a is a function of a single integer argument that returns int, so it can be added to b ; but
let ab2 ab = a 5 +b
analyzed as:
let ab2 ab = a (5) (+b)
with a is a function of two arguments, without the ability to deduce the type it returns.
1 I do not have a list of F # statements, so I canโt verify the correct name. Edit: it looks like I couldn't remember correctly: Arithmetic operators (F #) : -).
source share