Hi!
I was surprised that having User type defined in a module:
module User = {
type t = {
name:string,
age:int
}
};
and user list defined like this:
let users: list(User.t) = [];
to iterate over user list I can’t simply do:
users |> List.map(u => u.age); // age field is not visible!
but instead I need to bring module into the current scope either through:
users |> List.map((u: User.t) => u.age);
or
users |> List.map(u => u.User.age); // this one looks strange :)
or
User.(users |> List.map(u => u.age));
Why it is needed since users has explicit type list(User.t) ?