Where is the identifier "id" defined?
The FsUnit source code contains an unusual definition:
let be = id
FSI Output:
val was: ('a ->' a)The semantics of "id" is the form in parentheses of the following statement:
let be x = x
FSI Output:
val be: 'a ->' a
You can see a slight difference: the last example replaces the expression true> with true , while the first syntax will represent it as (true) .
What puzzles me is that I can not find the link to "id" in the F # language reference, and this is not described in the book "Programming F #". Moreover, “id” is not a reserved keyword, I can define “id” for something else, and then I can no longer use it in the way shown in the first example. Therefore, I am wondering if there are any F # documents that describe this literal and its semantics.
Most of these built-in functions defined in the library FSharp.Core, Microsoft.FSharp.Core.Operators.
They are documented on MSDN. Here id: http://msdn.microsoft.com/en-gb/library/ee353607.aspx