Firstly, I the only time i ever wrote Erlang code is the snipped ill present:
-type result() :: {foo, [string]} | bar.
readlines(FileName) ->
case file:open(FileName, [read]) of
{ok, Device} ->
try
Content = get_all_lines(Device),
{foo, Content}
after
file:close(Device)
end;
{error, Reason} ->
bar
% []
end.
Given this Erlang code and this Gleam type:
type ErlangResult {
Bar
Foo(List(String))
}
it appears to magically work. Is there some ressource (maybe its how types are represented in the BEAM?) for which I can learn more about type conversions and what works when?