A struct annotation uses F#’s struct keyword to select a value-tuple representation in a type expression or tuple operation. section 5.2.2
Apply the keyword consistently across the tuple’s use:
- Annotate the tuple type with struct. section 5.2.2
- Use struct when deconstructing the tuple. section 5.2.2
- Use struct when constructing the returned tuple. section 5.2.2
A struct tuple in a function
let makeDoctor (name : struct (string * string)) = let struct(_, sname) = name struct ("Dr", sname) The function accepts a struct tuple, ignores the forename, and returns a struct tuple containing a title and surname. section 5.2.2
Inspect the complete example with the struct keyword marked at the type annotation, deconstruction, and construction sites. section 5.2.2
