I’m always surprised by the following asymmetry between the pattern and expression language:
# type t = A of string;;
type t = A of string
# function Some A "bla" -> true | _ -> false;;
- : t option -> bool = <fun>
# let v = Some A "bla";;
Error: Syntax error
# let v = Some (A "bla");;
val v : t option = Some (A "bla")
Somehow I don’t see where the parenthesis constraint occurs in the expression language.
It appears in the precedence table, where it is stated that constructor application is left associative, hence the need for parentheses when you need to associate to the right.
I did not know that this was not case the case for patterns. I suppose the difference is that, in patterns, you cannot have function applications, so constructor applications can be made right-associative.