Is there a best practice when using potentially empty lists in domain models in F#? For example, in a todo app, a task could have 0 to N sub-tasks. Which way of modeling this is preferred?
type Task :
{ Name : string
SubTasks : Task list option }
or
type Task :
{ Name : string
SubTasks : Task list } //potentially empty
I am very much a beginner, but it seems to me like the business logic can work with either implementation. I would verify there are no sub-tasks by checking the option type or checking the list length for length = 0.
If we add the value of ParentTask : Task option to the Task record type, maybe it is better to make the SubTasks list an option as well?
Thanks!