I have two records that have a parent-child relationship:
type Parent =
{ Number: int
Child: Child }
and Child =
{ String: string
Parent: Parent }
I have tried initializing these using the following syntax, which doesn't work:
let rec parent =
{ Number = 1
Child = child }
and child =
{ String = "a"
Parent = parent }
this leads to
parent : Parent = { Number = 1
Child = null }
child : Child = { String = "a";
Parent = { Number = 1
Child = null } }
How to I initialize these without relying on mutable fields or copy-and-update after the fact using with
?