Let's say that I have a 1 -> n
relation: one todo can has many (or zero) notes and a note can have zero or one todo. How can I achieve this relation in ReasonML? (binding for an external lib)
Here is what I have come with at the moment (which is of course not working)
module Note = {
module Attributes = {
[@bs.deriving abstract]
type t = {
[@bs.optional]
id: float,
[@bs.optional]
text: string,
[@bs.optional]
todo: Todo.Attributes.t,
};
};
};
module Todo = {
[@bs.deriving abstract]
type t = {
[@bs.optional]
id: float,
[@bs.optional]
title: string,
[@bs.optional]
completed: bool,
[@bs.optional]
notes: array(Note.Attributes.t),
};
};
let todo = Todo.Attribute.t(~title="hello");
What if Note and Todo are in one file, an are in separated files?