Current section
Files
Jump to
Current section
Files
src/gleamgen@module.erl
-module(gleamgen@module).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([with_constant/3, with_import/2, with_imports_unchecked/2, with_function/3, with_custom_type1/3, with_custom_type2/3, with_custom_type3/3, with_custom_type4/3, with_custom_type5/3, with_custom_type6/3, with_custom_type7/3, with_custom_type8/3, with_custom_type9/3, with_custom_type_unchecked/3, with_type_alias/3, eof/0, render_imported_module/1, render/2]).
-export_type([definition/0, attribute/0, definition_details/0, definable/0, module_/0]).
-type definition() :: {definition, definition_details(), definable()}.
-type attribute() :: external_erlang |
external_javascript |
{deprecated, binary()} |
internal.
-type definition_details() :: {definition_details,
binary(),
boolean(),
list(attribute())}.
-type definable() :: {function,
gleamgen@function:function_(gleamgen@types:unchecked(), gleamgen@types:unchecked())} |
{custom_type_builder,
gleamgen@types@custom:custom_type_builder(gleamgen@types:unchecked(), nil, nil)} |
{constant, gleamgen@expression:expression(gleamgen@types:unchecked())} |
{type_alias, gleamgen@types:generated_type(gleamgen@types:unchecked())}.
-type module_() :: {module,
list(definition()),
list(gleamgen@import_:imported_module())}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 40).
-spec with_constant(
definition_details(),
gleamgen@expression:expression(NPK),
fun((gleamgen@expression:expression(NPK)) -> module_())
) -> module_().
with_constant(Details, Value, Handler) ->
Rest = Handler(
gleamgen@expression:unchecked_ident(erlang:element(2, Details))
),
_record = Rest,
{module,
[{definition,
Details,
{constant,
begin
_pipe = Value,
gleamgen_ffi:identity(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 52).
-spec with_import(
gleamgen@import_:imported_module(),
fun((gleamgen@import_:imported_module()) -> module_())
) -> module_().
with_import(Module, Handler) ->
Rest = Handler(Module),
_record = Rest,
{module, erlang:element(2, _record), [Module | erlang:element(3, Rest)]}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 60).
-spec with_imports_unchecked(
list(gleamgen@import_:imported_module()),
fun((list(gleamgen@import_:imported_module())) -> module_())
) -> module_().
with_imports_unchecked(Modules, Handler) ->
Rest = Handler(Modules),
_record = Rest,
{module,
erlang:element(2, _record),
lists:append(lists:reverse(Modules), erlang:element(3, Rest))}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 68).
-spec with_function(
definition_details(),
gleamgen@function:function_(NPP, any()),
fun((gleamgen@expression:expression(NPP)) -> module_())
) -> module_().
with_function(Details, Func, Handler) ->
Rest = Handler(
gleamgen@expression:unchecked_ident(erlang:element(2, Details))
),
_record = Rest,
{module,
[{definition,
Details,
{function,
begin
_pipe = Func,
gleamgen_ffi:identity(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 80).
-spec with_custom_type1(
definition_details(),
gleamgen@types@custom:custom_type_builder(NPU, {{}, NPV}, NPX),
fun((gleamgen@types@custom:custom_type(NPU, NPX), gleamgen@expression@constructor:constructor(NPU, NPV, NPX)) -> module_())
) -> module_().
with_custom_type1(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant1] = case _assert_subject of
[_] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type1"/utf8>>,
line => 89})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 106).
-spec with_custom_type2(
definition_details(),
gleamgen@types@custom:custom_type_builder(NQG, {{{}, NQH}, NQI}, NQL),
fun((gleamgen@types@custom:custom_type(NQG, NQL), gleamgen@expression@constructor:constructor(NQG, NQH, NQL), gleamgen@expression@constructor:constructor(NQG, NQI, NQL)) -> module_())
) -> module_().
with_custom_type2(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant2, Variant1] = case _assert_subject of
[_, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type2"/utf8>>,
line => 116})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 132).
-spec with_custom_type3(
definition_details(),
gleamgen@types@custom:custom_type_builder(NQX, {{{{}, NQY}, NQZ}, NRA}, NRE),
fun((gleamgen@types@custom:custom_type(NQX, NRE), gleamgen@expression@constructor:constructor(NQX, NQY, NRE), gleamgen@expression@constructor:constructor(NQX, NQZ, NRE), gleamgen@expression@constructor:constructor(NQX, NRA, NRE)) -> module_())
) -> module_().
with_custom_type3(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant3, Variant2, Variant1] = case _assert_subject of
[_, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type3"/utf8>>,
line => 143})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 160).
-spec with_custom_type4(
definition_details(),
gleamgen@types@custom:custom_type_builder(NRT, {{{{{}, NRU}, NRV}, NRW},
NRX}, NSC),
fun((gleamgen@types@custom:custom_type(NRT, NSC), gleamgen@expression@constructor:constructor(NRT, NRU, NSC), gleamgen@expression@constructor:constructor(NRT, NRV, NSC), gleamgen@expression@constructor:constructor(NRT, NRW, NSC), gleamgen@expression@constructor:constructor(NRT, NRX, NSC)) -> module_())
) -> module_().
with_custom_type4(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant4, Variant3, Variant2, Variant1] = case _assert_subject of
[_, _, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type4"/utf8>>,
line => 172})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3),
gleamgen@expression@constructor:new(Variant4)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 190).
-spec with_custom_type5(
definition_details(),
gleamgen@types@custom:custom_type_builder(NSU, {{{{{{}, NSV}, NSW}, NSX},
NSY},
NSZ}, NTF),
fun((gleamgen@types@custom:custom_type(NSU, NTF), gleamgen@expression@constructor:constructor(NSU, NSV, NTF), gleamgen@expression@constructor:constructor(NSU, NSW, NTF), gleamgen@expression@constructor:constructor(NSU, NSX, NTF), gleamgen@expression@constructor:constructor(NSU, NSY, NTF), gleamgen@expression@constructor:constructor(NSU, NSZ, NTF)) -> module_())
) -> module_().
with_custom_type5(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant5, Variant4, Variant3, Variant2, Variant1] = case _assert_subject of
[_, _, _, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type5"/utf8>>,
line => 207})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3),
gleamgen@expression@constructor:new(Variant4),
gleamgen@expression@constructor:new(Variant5)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 226).
-spec with_custom_type6(
definition_details(),
gleamgen@types@custom:custom_type_builder(NUA, {{{{{{{}, NUB}, NUC}, NUD},
NUE},
NUF},
NUG}, NUN),
fun((gleamgen@types@custom:custom_type(NUA, NUN), gleamgen@expression@constructor:constructor(NUA, NUB, NUN), gleamgen@expression@constructor:constructor(NUA, NUC, NUN), gleamgen@expression@constructor:constructor(NUA, NUD, NUN), gleamgen@expression@constructor:constructor(NUA, NUE, NUN), gleamgen@expression@constructor:constructor(NUA, NUF, NUN), gleamgen@expression@constructor:constructor(NUA, NUG, NUN)) -> module_())
) -> module_().
with_custom_type6(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant6, Variant5, Variant4, Variant3, Variant2, Variant1] = case _assert_subject of
[_, _, _, _, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type6"/utf8>>,
line => 244})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3),
gleamgen@expression@constructor:new(Variant4),
gleamgen@expression@constructor:new(Variant5),
gleamgen@expression@constructor:new(Variant6)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 265).
-spec with_custom_type7(
definition_details(),
gleamgen@types@custom:custom_type_builder(NVL, {{{{{{{{}, NVM}, NVN}, NVO},
NVP},
NVQ},
NVR},
NVS}, NWA),
fun((gleamgen@types@custom:custom_type(NVL, NWA), gleamgen@expression@constructor:constructor(NVL, NVM, NWA), gleamgen@expression@constructor:constructor(NVL, NVN, NWA), gleamgen@expression@constructor:constructor(NVL, NVO, NWA), gleamgen@expression@constructor:constructor(NVL, NVP, NWA), gleamgen@expression@constructor:constructor(NVL, NVQ, NWA), gleamgen@expression@constructor:constructor(NVL, NVR, NWA), gleamgen@expression@constructor:constructor(NVL, NVS, NWA)) -> module_())
) -> module_().
with_custom_type7(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant7, Variant6, Variant5, Variant4, Variant3, Variant2, Variant1] = case _assert_subject of
[_, _, _, _, _, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type7"/utf8>>,
line => 284})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3),
gleamgen@expression@constructor:new(Variant4),
gleamgen@expression@constructor:new(Variant5),
gleamgen@expression@constructor:new(Variant6),
gleamgen@expression@constructor:new(Variant7)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 313).
-spec with_custom_type8(
definition_details(),
gleamgen@types@custom:custom_type_builder(NXB, {{{{{{{{{}, NXC}, NXD}, NXE},
NXF},
NXG},
NXH},
NXI},
NXJ}, NXS),
fun((gleamgen@types@custom:custom_type(NXB, NXS), gleamgen@expression@constructor:constructor(NXB, NXC, NXS), gleamgen@expression@constructor:constructor(NXB, NXD, NXS), gleamgen@expression@constructor:constructor(NXB, NXE, NXS), gleamgen@expression@constructor:constructor(NXB, NXF, NXS), gleamgen@expression@constructor:constructor(NXB, NXG, NXS), gleamgen@expression@constructor:constructor(NXB, NXH, NXS), gleamgen@expression@constructor:constructor(NXB, NXI, NXS), gleamgen@expression@constructor:constructor(NXB, NXJ, NXS)) -> module_())
) -> module_().
with_custom_type8(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1] = case _assert_subject of
[_, _, _, _, _, _, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type8"/utf8>>,
line => 333})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3),
gleamgen@expression@constructor:new(Variant4),
gleamgen@expression@constructor:new(Variant5),
gleamgen@expression@constructor:new(Variant6),
gleamgen@expression@constructor:new(Variant7),
gleamgen@expression@constructor:new(Variant8)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 364).
-spec with_custom_type9(
definition_details(),
gleamgen@types@custom:custom_type_builder(NYW, {{{{{{{{{{}, NYX}, NYY}, NYZ},
NZA},
NZB},
NZC},
NZD},
NZE},
NZF}, NZP),
fun((gleamgen@types@custom:custom_type(NYW, NZP), gleamgen@expression@constructor:constructor(NYW, NYX, NZP), gleamgen@expression@constructor:constructor(NYW, NYY, NZP), gleamgen@expression@constructor:constructor(NYW, NYZ, NZP), gleamgen@expression@constructor:constructor(NYW, NZA, NZP), gleamgen@expression@constructor:constructor(NYW, NZB, NZP), gleamgen@expression@constructor:constructor(NYW, NZC, NZP), gleamgen@expression@constructor:constructor(NYW, NZD, NZP), gleamgen@expression@constructor:constructor(NYW, NZE, NZP), gleamgen@expression@constructor:constructor(NYW, NZF, NZP)) -> module_())
) -> module_().
with_custom_type9(Details, Type_, Handler) ->
_assert_subject = erlang:element(2, Type_),
[Variant9,
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1] = case _assert_subject of
[_, _, _, _, _, _, _, _, _] -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type9"/utf8>>,
line => 385})
end,
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
gleamgen@expression@constructor:new(Variant1),
gleamgen@expression@constructor:new(Variant2),
gleamgen@expression@constructor:new(Variant3),
gleamgen@expression@constructor:new(Variant4),
gleamgen@expression@constructor:new(Variant5),
gleamgen@expression@constructor:new(Variant6),
gleamgen@expression@constructor:new(Variant7),
gleamgen@expression@constructor:new(Variant8),
gleamgen@expression@constructor:new(Variant9)
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@types@custom:to_unchecked(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 420).
-spec with_custom_type_unchecked(
definition_details(),
gleamgen@types@custom:custom_type_builder(OAW, gleamgen@types:unchecked(), OAX),
fun((gleamgen@types@custom:custom_type(OAW, OAX), list(gleamgen@expression@constructor:constructor(OAW, gleamgen@types:unchecked(), OAX))) -> module_())
) -> module_().
with_custom_type_unchecked(Details, Type_, Handler) ->
Rest = Handler(
{custom_type, none, erlang:element(2, Details)},
begin
_pipe = erlang:element(2, Type_),
_pipe@1 = lists:reverse(_pipe),
gleam@list:map(_pipe@1, fun gleamgen@expression@constructor:new/1)
end
),
_record = Rest,
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe@2 = Type_,
gleamgen@types@custom:to_unchecked(_pipe@2)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 443).
-spec with_type_alias(
definition_details(),
gleamgen@types:generated_type(OBH),
fun((gleamgen@types:generated_type(OBH)) -> module_())
) -> module_().
with_type_alias(Details, Type_, Handler) ->
Rest = Handler(gleamgen@types:unchecked_ident(erlang:element(2, Details))),
_record = Rest,
{module,
[{definition,
Details,
{type_alias,
begin
_pipe = Type_,
gleamgen_ffi:identity(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, _record)}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 455).
-spec eof() -> module_().
eof() ->
{module, [], []}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 552).
-spec render_attribute(attribute()) -> glam@doc:document().
render_attribute(Attribute) ->
case Attribute of
external_erlang ->
glam@doc:from_string(<<"@external(erlang)"/utf8>>);
external_javascript ->
glam@doc:from_string(<<"@external(javascript)"/utf8>>);
{deprecated, Reason} ->
glam@doc:concat(
[glam@doc:from_string(<<"@deprecated(\""/utf8>>),
glam@doc:from_string(Reason),
glam@doc:from_string(<<"\")"/utf8>>)]
);
internal ->
glam@doc:from_string(<<"@internal"/utf8>>)
end.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 566).
-spec render_imported_module(gleamgen@import_:imported_module()) -> gleamgen@render:rendered().
render_imported_module(Module) ->
_pipe = glam@doc:concat(
[glam@doc:from_string(<<"import "/utf8>>),
glam@doc:from_string(
gleam@string:join(erlang:element(2, Module), <<"/"/utf8>>)
),
case erlang:element(3, Module) of
{some, Alias} ->
glam@doc:concat(
[{break, <<" "/utf8>>, <<""/utf8>>},
glam@doc:from_string(<<"as"/utf8>>),
{break, <<" "/utf8>>, <<""/utf8>>},
glam@doc:from_string(Alias)]
);
none ->
{concat, []}
end]
),
{render, _pipe, {rendered_details, []}}.
-file("/home/weasel/gleam/testing_gleamgen/gleamgen/src/gleamgen/module.gleam", 459).
-spec render(module_(), gleamgen@render:context()) -> gleamgen@render:rendered().
render(Module, Context) ->
{Details@1, Rendered_defs} = gleam@list:map_fold(
erlang:element(2, Module),
{rendered_details, []},
fun(Previous_details, Def) ->
{Definition, Details} = case erlang:element(3, Def) of
{constant, Value} ->
Rendered_expr = gleamgen@expression:render(Value, Context),
{glam@doc:concat(
[glam@doc:from_string(<<"const "/utf8>>),
glam@doc:from_string(
erlang:element(2, erlang:element(2, Def))
),
{break, <<" "/utf8>>, <<""/utf8>>},
glam@doc:from_string(<<"="/utf8>>),
{break, <<" "/utf8>>, <<""/utf8>>},
erlang:element(2, Rendered_expr)]
),
erlang:element(3, Rendered_expr)};
{custom_type_builder, Type_} ->
Rendered_type = gleamgen@types@custom:render(Type_),
{glam@doc:concat(
[glam@doc:from_string(<<"type "/utf8>>),
glam@doc:from_string(
erlang:element(2, erlang:element(2, Def))
),
erlang:element(2, Rendered_type)]
),
erlang:element(3, Rendered_type)};
{type_alias, Type_@1} ->
Rendered_type@1 = gleamgen@types:render_type(Type_@1),
{glam@doc:concat(
[glam@doc:from_string(<<"type "/utf8>>),
glam@doc:from_string(
erlang:element(2, erlang:element(2, Def))
),
{break, <<" "/utf8>>, <<""/utf8>>},
glam@doc:from_string(<<"="/utf8>>),
{break, <<" "/utf8>>, <<""/utf8>>},
begin
_pipe = Rendered_type@1,
_pipe@1 = gleam@result:map(
_pipe,
fun(V) -> erlang:element(2, V) end
),
gleam@result:unwrap(
_pipe@1,
glam@doc:from_string(<<"??"/utf8>>)
)
end]
),
begin
_pipe@2 = Rendered_type@1,
_pipe@3 = gleam@result:map(
_pipe@2,
fun(V@1) -> erlang:element(3, V@1) end
),
gleam@result:unwrap(_pipe@3, {rendered_details, []})
end};
{function, Func} ->
Rendered = gleamgen@function:render(
Func,
Context,
{some, erlang:element(2, erlang:element(2, Def))}
),
{erlang:element(2, Rendered), erlang:element(3, Rendered)}
end,
Full_doc = begin
_pipe@4 = glam@doc:join(
gleam@list:map(
erlang:element(4, erlang:element(2, Def)),
fun render_attribute/1
),
{line, 1}
),
_pipe@5 = glam@doc:append(
_pipe@4,
case gleam@list:is_empty(
erlang:element(4, erlang:element(2, Def))
) of
true ->
{concat, []};
false ->
{line, 1}
end
),
_pipe@6 = glam@doc:append(
_pipe@5,
case erlang:element(3, erlang:element(2, Def)) of
true ->
glam@doc:concat(
[glam@doc:from_string(<<"pub"/utf8>>),
{break, <<" "/utf8>>, <<""/utf8>>}]
);
false ->
{concat, []}
end
),
glam@doc:append(_pipe@6, Definition)
end,
{gleamgen@render:merge_details(Details, Previous_details), Full_doc}
end
),
Rendered_imports = begin
_pipe@7 = erlang:element(3, Module),
_pipe@9 = gleam@list:filter(
_pipe@7,
fun(M) -> _pipe@8 = erlang:element(2, Details@1),
gleam@list:contains(_pipe@8, gleamgen@import_:get_reference(M)) end
),
_pipe@12 = gleam@list:map(_pipe@9, fun(X) -> _pipe@10 = X,
_pipe@11 = render_imported_module(_pipe@10),
gleamgen@render:to_string(_pipe@11) end),
_pipe@13 = gleam@list:sort(_pipe@12, fun gleam@string:compare/2),
_pipe@14 = gleam@list:map(_pipe@13, fun glam@doc:from_string/1),
_pipe@15 = glam@doc:join(_pipe@14, {line, 1}),
glam@doc:append(
_pipe@15,
case gleam@list:is_empty(erlang:element(3, Module)) of
true ->
{concat, []};
false ->
glam@doc:concat([{line, 1}, {line, 1}])
end
)
end,
_pipe@16 = Rendered_imports,
_pipe@17 = glam@doc:append(
_pipe@16,
glam@doc:concat_join(Rendered_defs, [{line, 1}, {line, 1}])
),
{render, _pipe@17, Details@1}.