This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// General hints on defining types with constraints or invariants | |
// | |
// Just as in C#, use a private constructor | |
// and expose "factory" methods that enforce the constraints | |
// | |
// In F#, only classes can have private constructors with public members. | |
// | |
// If you want to use the record and DU types, the whole type becomes | |
// private, which means that you also need to provide: | |
// * a constructor function ("create"). |