2 ms·
The F# code isn't as slick as it should be. This is much better: type FullName = FullName of string This is a sum type (discriminated union) with a single c
by MichaelGG 14y ago
The F# code isn't as slick as it should be. This is much better:
type FullName = FullName of string
This is a sum type (discriminated union) with a single case. If you want to have a simple accessor just add:
with member x.Value = match x with FullName x -> x
I'm not sure why you'd create all those records; it seems very messy.
Edit: Also, phantom types may be of interest. Here's an example in F#:
http://stackoverflow.com/questions/3583679/implementing-phantom-types-in-f http://stackoverflow.com/questions/3583679/implementing-phan...