A friend and I are reading up on F# and are messing around with records at the moment.
We have made the following record for representing a person:
t
If you declare father
and mother
as Parent option
then you can use it like:
let f = { name = "Father"; father = None; mother = None }
let m = { name = "Mother"; father = None; mother = None }
let c = { name = "Child"; father = Some(f); mother = Some(m) }
without using Parent option
for father
and mother
you would have to create a "null parent" instance and use that instead of None
.