Hello.
I’m just exploring the code generated by spin fro a basic CLI application and I found something that I don’t understand.
There is the module error wich contains this:
type error = {
doc: string,
exit_code: int,
};
let all = () => [
{doc: "on missing required environment variable.", exit_code: 201},
];
Then on some other part of the codebase, there is this line:
Reason_ls.Errors.all()
|> List.map(~f=el =>
Reason_ls.Errors.(Term.exit_info(el.exit_code, ~doc=el.doc))
),
I was asking myself what was the opening of the Errors module for… after all, the el
var has all the things you may need… So I deleted it to discover that you can not access the fields of a type defined in another module even if you have a reference to an instance of that type.
Why is this? What is the reasoning behind that? Does it happen for everything?