So, you want to create a value type? Easy, just use the [<Struct>] attribute to mark your type. Oh, but you want a non-default constructor. Well that is okay too. Ah, but you want an immutable type that can handle the default constructor? Now that is interesting…
F#: Custom Value Types with Controlled Zero Value Semantics
Leave a reply