Please, could someone explain why here the function type is inferred to be string -> string?
let myFunc a:string =
match a with
| "A" -> 1
| _ -> 0
This works fine when the argument is generic, but as soon as I add :string the type changes. Why?
Edit: I want to declare the argument type to be a string as I actually want to use String.ToUpper() for the match:
let myFunc a:string =
match a.ToUpper() with
| "A" -> 1
| _ -> 0
A bit awkward solution would, be this
let myFunc a =
match a.ToString().ToUpper() with
| "A" -> 1
| _ -> 0
But I really know it will be a string