Addressing some compile-time problems
Although REPL can help explore and tweak correct F# code, it keeps compiler errors intact, as evaluating a code snippet includes compilation by the F# compiler embedded into fsi
. And I must admit that some compile-time errors may puzzle an inexperienced F# developer. Here, I will analyze several kinds of such errors and provide advice on how to get rid of them. Before I do this, you should keep in mind that because an initial defect usually gets ingested by type inference as correct code, the reported compilation error is in line with that convoluted type inference determination. That is, type inference often masks the authentic cause of an error. We will go over some occasions of this layout soon.
The if-then return value
One of the easiest-to-grasp occurrences of the similar convoluted determination takes place for the result type of F# if...then...
expressions. Usually, it seems counterintuitive that this result cannot be anything but unit
. Let&apos...