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, inline]).
-define(FILEPATH, "src/gleamgen/module.gleam").
-export([from_source_map/1, with_module_documentation_comments/2, with_constant/3, with_import/2, with_dynamic_imports/2, replace_function/5, with_function/3, with_custom_type1/3, with_imported_custom_type1/4, with_custom_type2/3, with_imported_custom_type2/4, with_custom_type3/3, with_imported_custom_type3/4, with_custom_type4/3, with_imported_custom_type4/4, with_custom_type5/3, with_imported_custom_type5/4, with_custom_type6/3, with_imported_custom_type6/4, with_custom_type7/3, with_imported_custom_type7/4, with_custom_type8/3, with_imported_custom_type8/4, with_custom_type9/3, with_imported_custom_type9/4, with_custom_type_dynamic/3, with_imported_custom_type_dynamic/4, with_type_alias/3, eof/0, render_imported_module/1, render/2]).
-export_type([external_module/0, module_/0, predefined_definition/0, module_definition/0, definable/0, replacement_config/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-opaque external_module() :: {external_module,
gleam@option:option(gleamgen@source:source_mapped(glance:module_())),
list(module_definition())}.
-opaque module_() :: {module,
list(module_definition()),
list(gleamgen@import_:imported_module()),
gleam@option:option(external_module()),
list(binary())}.
-type predefined_definition() :: {predefined_import,
glance:definition(glance:import())} |
{predefined_custom_type, glance:definition(glance:custom_type())} |
{predefined_type_alias, glance:definition(glance:type_alias())} |
{predefined_constant, glance:definition(glance:constant())} |
{predefined_function, glance:definition(glance:function_())}.
-type module_definition() :: {definition,
gleamgen@module@definition:definition(),
definable()}.
-opaque definable() :: {function,
gleamgen@function:function_(gleamgen@type_:dynamic_(), gleamgen@type_:dynamic_())} |
{custom_type_builder,
gleamgen@type_@custom:custom_type_builder(gleamgen@type_:dynamic_(), nil, nil)} |
{constant, gleamgen@expression:expression(gleamgen@type_:dynamic_())} |
{type_alias, gleamgen@type_:generated_type(gleamgen@type_:dynamic_())} |
{predefined,
predefined_definition(),
binary(),
binary(),
gleamgen@source:source()}.
-type replacement_config() :: replacement_inline |
{replacement_update_definition,
fun((gleamgen@module@definition:definition()) -> gleamgen@module@definition:definition())}.
-file("src/gleamgen/module.gleam", 95).
-spec handle_existing_definition(
predefined_definition(),
module_(),
binary(),
binary(),
gleamgen@source:source()
) -> module_().
handle_existing_definition(
Predefined_definition,
Module,
Before_text,
Definition_text,
Source
) ->
Add_definition = fun(Name, Publicity, Attributes) ->
External_module = begin
_pipe = erlang:element(4, Module),
gleam@option:unwrap(_pipe, {external_module, none, []})
end,
Is_public = case Publicity of
public ->
true;
private ->
false
end,
Attributes@1 = gleam@list:filter_map(
Attributes,
fun gleamgen@module@definition:attribute_from_glance/1
),
Details = begin
_pipe@1 = gleamgen@module@definition:new(Name),
_pipe@2 = gleamgen@module@definition:with_publicity(
_pipe@1,
Is_public
),
_pipe@3 = gleamgen@module@definition:with_attributes(
_pipe@2,
Attributes@1
),
_pipe@4 = gleamgen@module@definition:with_text_before(
_pipe@3,
Before_text
),
gleamgen@module@definition:set_predefined(_pipe@4, true)
end,
New_definition = {definition,
Details,
{predefined,
Predefined_definition,
Before_text,
Definition_text,
Source}},
{module,
erlang:element(2, Module),
erlang:element(3, Module),
{some,
{external_module,
erlang:element(2, External_module),
[New_definition | erlang:element(3, External_module)]}},
erlang:element(5, Module)}
end,
case Predefined_definition of
{predefined_import, Definition} ->
New_import = gleamgen@import_:convert_import(
Definition,
Before_text
),
{module,
erlang:element(2, Module),
[New_import | erlang:element(3, Module)],
erlang:element(4, Module),
erlang:element(5, Module)};
{predefined_constant, Definition@1} ->
Add_definition(
erlang:element(3, erlang:element(3, Definition@1)),
erlang:element(4, erlang:element(3, Definition@1)),
erlang:element(2, Definition@1)
);
{predefined_custom_type, Definition@2} ->
Add_definition(
erlang:element(3, erlang:element(3, Definition@2)),
erlang:element(4, erlang:element(3, Definition@2)),
erlang:element(2, Definition@2)
);
{predefined_type_alias, Definition@3} ->
Add_definition(
erlang:element(3, erlang:element(3, Definition@3)),
erlang:element(4, erlang:element(3, Definition@3)),
erlang:element(2, Definition@3)
);
{predefined_function, Definition@4} ->
Add_definition(
erlang:element(3, erlang:element(3, Definition@4)),
erlang:element(4, erlang:element(3, Definition@4)),
erlang:element(2, Definition@4)
)
end.
-file("src/gleamgen/module.gleam", 63).
-spec from_source_map(gleamgen@source:source_mapped(glance:module_())) -> module_().
from_source_map(Module) ->
Get_location = fun(Definition) -> case Definition of
{predefined_import, Def} ->
erlang:element(2, erlang:element(3, Def));
{predefined_constant, Def@1} ->
erlang:element(2, erlang:element(3, Def@1));
{predefined_custom_type, Def@2} ->
erlang:element(2, erlang:element(3, Def@2));
{predefined_type_alias, Def@3} ->
erlang:element(2, erlang:element(3, Def@3));
{predefined_function, Def@4} ->
erlang:element(2, erlang:element(3, Def@4))
end end,
{Module@1, _} = begin
_pipe = [gleam@list:map(
erlang:element(2, erlang:element(2, Module)),
fun(Field@0) -> {predefined_import, Field@0} end
),
gleam@list:map(
erlang:element(5, erlang:element(2, Module)),
fun(Field@0) -> {predefined_constant, Field@0} end
),
gleam@list:map(
erlang:element(3, erlang:element(2, Module)),
fun(Field@0) -> {predefined_custom_type, Field@0} end
),
gleam@list:map(
erlang:element(4, erlang:element(2, Module)),
fun(Field@0) -> {predefined_type_alias, Field@0} end
),
gleam@list:map(
erlang:element(6, erlang:element(2, Module)),
fun(Field@0) -> {predefined_function, Field@0} end
)],
_pipe@1 = lists:append(_pipe),
_pipe@2 = gleam@list:sort(
_pipe@1,
fun(First, Second) ->
gleam@int:compare(
erlang:element(2, Get_location(First)),
erlang:element(2, Get_location(Second))
)
end
),
gleamgen@source:fold(
_pipe@2,
erlang:element(3, Module),
{module, [], [], {some, {external_module, {some, Module}, []}}, []},
fun handle_existing_definition/5,
Get_location
)
end,
Module@1.
-file("src/gleamgen/module.gleam", 175).
-spec with_module_documentation_comments(list(binary()), fun(() -> module_())) -> module_().
with_module_documentation_comments(Comments, Handler) ->
Rest = Handler(),
{module,
erlang:element(2, Rest),
erlang:element(3, Rest),
erlang:element(4, Rest),
Comments}.
-file("src/gleamgen/module.gleam", 183).
-spec with_constant(
gleamgen@module@definition:definition(),
gleamgen@expression:expression(PBQ),
fun((gleamgen@expression:expression(PBQ)) -> module_())
) -> module_().
with_constant(Details, Value, Handler) ->
Rest = Handler(
gleamgen@expression:raw(gleamgen@module@definition:get_name(Details))
),
{module,
[{definition,
Details,
{constant,
begin
_pipe = Value,
gleamgen_ffi:identity(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 195).
-spec with_import(
gleamgen@import_:imported_module(),
fun((gleamgen@internal@import_reference:import_reference()) -> module_())
) -> module_().
with_import(Module, Handler) ->
Rest = Handler(gleamgen@import_:import_to_reference(Module)),
{module,
erlang:element(2, Rest),
[Module | erlang:element(3, Rest)],
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 203).
-spec with_dynamic_imports(
list(gleamgen@import_:imported_module()),
fun((list(gleamgen@import_:imported_module())) -> module_())
) -> module_().
with_dynamic_imports(Modules, Handler) ->
Rest = Handler(Modules),
{module,
erlang:element(2, Rest),
lists:append(lists:reverse(Modules), erlang:element(3, Rest)),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 218).
-spec replace_function(
binary(),
module_(),
fun((gleam@option:option(gleamgen@source:source_mapped(glance:function_()))) -> gleamgen@function:function_(PBX, any())),
replacement_config(),
fun((module_(), gleamgen@expression:expression(PBX)) -> module_())
) -> module_().
replace_function(Function_name, Module, Func, Config, Handler) ->
Rest = Handler(Module, gleamgen@expression:raw(Function_name)),
case erlang:element(4, Module) of
{some, {external_module, _, Definitions} = External_module} ->
Definitions@1 = gleam@list:map(
Definitions,
fun(Definition) ->
gleam@bool:guard(
gleamgen@module@definition:get_name(
erlang:element(2, Definition)
)
/= Function_name,
Definition,
fun() ->
{Details@1, Value} = case erlang:element(
3,
Definition
) of
{predefined,
{predefined_function, F},
_,
_,
Source} ->
Details = case Config of
replacement_inline ->
erlang:element(2, Definition);
{replacement_update_definition,
Update_fn} ->
Update_fn(
erlang:element(2, Definition)
)
end,
{gleamgen@module@definition:set_predefined(
Details,
false
),
{function,
begin
_pipe = Func(
{some,
{source_mapped,
erlang:element(3, F),
Source}}
),
gleamgen_ffi:identity(_pipe)
end}};
V ->
{erlang:element(2, Definition), V}
end,
{definition, Details@1, Value}
end
)
end
),
{module,
erlang:element(2, Module),
erlang:element(3, Module),
{some,
{external_module,
erlang:element(2, External_module),
Definitions@1}},
erlang:element(5, Module)};
none ->
{module,
[{definition,
gleamgen@module@definition:new(Function_name),
{function,
begin
_pipe@1 = Func(none),
gleamgen_ffi:identity(_pipe@1)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}
end.
-file("src/gleamgen/module.gleam", 281).
-spec with_function(
gleamgen@module@definition:definition(),
gleamgen@function:function_(PCC, any()),
fun((gleamgen@expression:expression(PCC)) -> module_())
) -> module_().
with_function(Details, Func, Handler) ->
Rest = Handler(
gleamgen@expression:raw(gleamgen@module@definition:get_name(Details))
),
{module,
[{definition,
Details,
{function,
begin
_pipe = Func,
gleamgen_ffi:identity(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 316).
?DOC(
" Define a custom type with one variant.\n"
"\n"
" ```gleam\n"
" let cat =\n"
" custom.new()\n"
" |> custom.with_variant(fn(_) {\n"
" variant.new(\"Cat\")\n"
" |> variant.with_argument(option.Some(\"name\"), type_.string)\n"
" |> variant.with_argument(option.Some(\"age\"), type_.int)\n"
" |> variant.with_argument(option.Some(\"has_catnip\"), type_.bool)\n"
" })\n"
"\n"
" use cat_type, cat_constructor <- module.with_custom_type1(\n"
" definition.new(\"Cat\"),\n"
" cat,\n"
" )\n"
" ```\n"
"\n"
" The type can be instantiated with [`custom.to_type`](type_/custom.html#to_type1).\n"
" The constructors can be used to create values of the type ([`constructor.to_expression`](expression/constructor.html#to_expression1))\n"
" or pattern match on values of the type ([`pattern.from_constructor`](pattern.html#from_constructor1)).\n"
"\n"
" To define a custom type with a dynamic number of variants, see [`with_custom_type_dynamic`](#with_custom_type_dynamic).\n"
).
-spec with_custom_type1(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PCH, {{}, PCI}, PCK),
fun((gleamgen@type_@custom:custom_type(PCH, PCK), gleamgen@expression@constructor:constructor(PCH, PCI, PCK)) -> module_())
) -> module_().
with_custom_type1(Details, Type_, Handler) ->
Variant1@1 = case erlang:element(2, Type_) of
[Variant1] -> Variant1;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type1"/utf8>>,
line => 325,
value => _assert_fail,
start => 9580,
'end' => 9618,
pattern_start => 9591,
pattern_end => 9601})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 362).
?DOC(
" Import a custom type with one variant.\n"
"\n"
" ```gleam\n"
" use cat_module <- module.with_import(import_.new([\"animal\", \"cat\"]))\n"
" let cat =\n"
" custom.new()\n"
" |> custom.with_variant(fn(_) {\n"
" variant.new(\"Cat\")\n"
" |> variant.with_argument(option.Some(\"name\"), type_.string)\n"
" |> variant.with_argument(option.Some(\"age\"), type_.int)\n"
" |> variant.with_argument(option.Some(\"has_catnip\"), type_.bool)\n"
" })\n"
"\n"
" use cat_type, cat_constructor <- module.with_imported_custom_type1(\n"
" cat_module,\n"
" \"Cat\"\n"
" cat,\n"
" )\n"
" ```\n"
"\n"
" The type can be instantiated with [`custom.to_type`](type_/custom.html#to_type1).\n"
" The constructors can be used to create values of the type ([`constructor.to_expression`](expression/constructor.html#to_expression1))\n"
" or pattern match on values of the type ([`pattern.from_constructor`](pattern.html#from_constructor1)).\n"
"\n"
" To define a custom type with a dynamic number of variants, see [`with_custom_type_dynamic`](#with_custom_type_dynamic).\n"
).
-spec with_imported_custom_type1(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PCT, {{}, PCU}, PCW),
fun((gleamgen@type_@custom:custom_type(PCT, PCW), gleamgen@expression@constructor:constructor(PCT, PCU, PCW)) -> module_())
) -> module_().
with_imported_custom_type1(Module, Name, Type_, Handler) ->
Variant1@1 = case erlang:element(2, Type_) of
[Variant1] -> Variant1;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type1"/utf8>>,
line => 372,
value => _assert_fail,
start => 11247,
'end' => 11285,
pattern_start => 11258,
pattern_end => 11268})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1)
).
-file("src/gleamgen/module.gleam", 405).
?DOC(
" Define a custom type with two variants.\n"
" ```gleam\n"
" let animals =\n"
" custom.new()\n"
" |> custom.with_variant(fn(_) {\n"
" variant.new(\"Dog\")\n"
" |> variant.with_argument(option.Some(\"bones\"), type_.int)\n"
" })\n"
" |> custom.with_variant(fn(_) {\n"
" variant.new(\"Cat\")\n"
" |> variant.with_argument(option.Some(\"name\"), type_.string)\n"
" |> variant.with_argument(option.Some(\"has_catnip\"), type_.bool)\n"
" })\n"
"\n"
" use animal_type, dog_constructor, cat_constructor <- module.with_custom_type2(\n"
" definition.new(\"Animal\") |> definition.with_publicity(True),\n"
" animals,\n"
" )\n"
" ```\n"
" The type can be instantiated with [`custom.to_type`](type_/custom.html#to_type1).\n"
" The constructors can be used to create values of the type ([`constructor.to_expression`](expression/constructor.html#to_expression1))\n"
" or pattern match on values of the type ([`pattern.from_constructor`](pattern.html#from_constructor1)).\n"
"\n"
" To define a custom type with a dynamic number of variants, see [`with_custom_type_dynamic`](#with_custom_type_dynamic).\n"
).
-spec with_custom_type2(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PDF, {{{}, PDG}, PDH}, PDK),
fun((gleamgen@type_@custom:custom_type(PDF, PDK), gleamgen@expression@constructor:constructor(PDF, PDG, PDK), gleamgen@expression@constructor:constructor(PDF, PDH, PDK)) -> module_())
) -> module_().
with_custom_type2(Details, Type_, Handler) ->
{Variant2@1, Variant1@1} = case erlang:element(2, Type_) of
[Variant2, Variant1] -> {Variant2, Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type2"/utf8>>,
line => 415,
value => _assert_fail,
start => 12827,
'end' => 12875,
pattern_start => 12838,
pattern_end => 12858})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 452).
?DOC(
" Import a custom type with two variants.\n"
" ```gleam\n"
" use option_module <- module.with_import(import_.new([\"gleam\", \"option\"]))\n"
" let option =\n"
" custom.new()\n"
" |> custom.with_generic(\"a\")\n"
" |> custom.with_variant(fn(generics) {\n"
" let #(#(), a) = generics\n"
" variant.new(\"Some\")\n"
" |> variant.with_argument(option.None, a)\n"
" })\n"
" |> custom.with_variant(fn(_generics) { variant.new(\"None\") })\n"
"\n"
" use option_type, some_constructor, none_constructor <- module.with_imported_custom_type2(\n"
" option_module,\n"
" \"Option\",\n"
" option,\n"
" )\n"
" ```\n"
" The type can be instantiated with [`custom.to_type`](type_/custom.html#to_type1).\n"
" The constructors can be used to create values of the type ([`constructor.to_expression`](expression/constructor.html#to_expression1))\n"
" or pattern match on values of the type ([`pattern.from_constructor`](pattern.html#from_constructor1)).\n"
"\n"
" To import a custom type with a dynamic number of variants, see [`with_imported_custom_type_dynamic`](#with_imported_custom_type_dynamic).\n"
).
-spec with_imported_custom_type2(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PDW, {{{}, PDX}, PDY}, PEB),
fun((gleamgen@type_@custom:custom_type(PDW, PEB), gleamgen@expression@constructor:constructor(PDW, PDX, PEB), gleamgen@expression@constructor:constructor(PDW, PDY, PEB)) -> module_())
) -> module_().
with_imported_custom_type2(Module, Name, Type_, Handler) ->
{Variant2@1, Variant1@1} = case erlang:element(2, Type_) of
[Variant2, Variant1] -> {Variant2, Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type2"/utf8>>,
line => 463,
value => _assert_fail,
start => 14640,
'end' => 14688,
pattern_start => 14651,
pattern_end => 14671})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1)
).
-file("src/gleamgen/module.gleam", 473).
?DOC(
" Define a custom type with three variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type3(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PEN, {{{{}, PEO}, PEP}, PEQ}, PEU),
fun((gleamgen@type_@custom:custom_type(PEN, PEU), gleamgen@expression@constructor:constructor(PEN, PEO, PEU), gleamgen@expression@constructor:constructor(PEN, PEP, PEU), gleamgen@expression@constructor:constructor(PEN, PEQ, PEU)) -> module_())
) -> module_().
with_custom_type3(Details, Type_, Handler) ->
{Variant3@1, Variant2@1, Variant1@1} = case erlang:element(2, Type_) of
[Variant3, Variant2, Variant1] -> {Variant3, Variant2, Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type3"/utf8>>,
line => 484,
value => _assert_fail,
start => 15334,
'end' => 15392,
pattern_start => 15345,
pattern_end => 15375})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 500).
?DOC(
" Import a custom type with three variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type3(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PFJ, {{{{}, PFK}, PFL}, PFM}, PFQ),
fun((gleamgen@type_@custom:custom_type(PFJ, PFQ), gleamgen@expression@constructor:constructor(PFJ, PFK, PFQ), gleamgen@expression@constructor:constructor(PFJ, PFL, PFQ), gleamgen@expression@constructor:constructor(PFJ, PFM, PFQ)) -> module_())
) -> module_().
with_imported_custom_type3(Module, Name, Type_, Handler) ->
{Variant3@1, Variant2@1, Variant1@1} = case erlang:element(2, Type_) of
[Variant3, Variant2, Variant1] -> {Variant3, Variant2, Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type3"/utf8>>,
line => 512,
value => _assert_fail,
start => 16293,
'end' => 16351,
pattern_start => 16304,
pattern_end => 16334})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1)
).
-file("src/gleamgen/module.gleam", 523).
?DOC(
" Define a custom type with four variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type4(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PGF, {{{{{}, PGG}, PGH}, PGI},
PGJ}, PGO),
fun((gleamgen@type_@custom:custom_type(PGF, PGO), gleamgen@expression@constructor:constructor(PGF, PGG, PGO), gleamgen@expression@constructor:constructor(PGF, PGH, PGO), gleamgen@expression@constructor:constructor(PGF, PGI, PGO), gleamgen@expression@constructor:constructor(PGF, PGJ, PGO)) -> module_())
) -> module_().
with_custom_type4(Details, Type_, Handler) ->
{Variant4@1, Variant3@1, Variant2@1, Variant1@1} = case erlang:element(
2,
Type_
) of
[Variant4, Variant3, Variant2, Variant1] -> {
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type4"/utf8>>,
line => 535,
value => _assert_fail,
start => 17099,
'end' => 17167,
pattern_start => 17110,
pattern_end => 17150})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1),
gleamgen@expression@constructor:new(none, Variant4@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 552).
?DOC(
" Import a custom type with four variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type4(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PHG, {{{{{}, PHH}, PHI}, PHJ},
PHK}, PHP),
fun((gleamgen@type_@custom:custom_type(PHG, PHP), gleamgen@expression@constructor:constructor(PHG, PHH, PHP), gleamgen@expression@constructor:constructor(PHG, PHI, PHP), gleamgen@expression@constructor:constructor(PHG, PHJ, PHP), gleamgen@expression@constructor:constructor(PHG, PHK, PHP)) -> module_())
) -> module_().
with_imported_custom_type4(Module, Name, Type_, Handler) ->
{Variant4@1, Variant3@1, Variant2@1, Variant1@1} = case erlang:element(
2,
Type_
) of
[Variant4, Variant3, Variant2, Variant1] -> {
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type4"/utf8>>,
line => 565,
value => _assert_fail,
start => 18164,
'end' => 18232,
pattern_start => 18175,
pattern_end => 18215})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1),
gleamgen@expression@constructor:new({some, Module}, Variant4@1)
).
-file("src/gleamgen/module.gleam", 577).
?DOC(
" Define a custom type with five variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type5(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PIH, {{{{{{}, PII}, PIJ}, PIK},
PIL},
PIM}, PIS),
fun((gleamgen@type_@custom:custom_type(PIH, PIS), gleamgen@expression@constructor:constructor(PIH, PII, PIS), gleamgen@expression@constructor:constructor(PIH, PIJ, PIS), gleamgen@expression@constructor:constructor(PIH, PIK, PIS), gleamgen@expression@constructor:constructor(PIH, PIL, PIS), gleamgen@expression@constructor:constructor(PIH, PIM, PIS)) -> module_())
) -> module_().
with_custom_type5(Details, Type_, Handler) ->
{Variant5@1, Variant4@1, Variant3@1, Variant2@1, Variant1@1} = case erlang:element(
2,
Type_
) of
[Variant5, Variant4, Variant3, Variant2, Variant1] -> {
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type5"/utf8>>,
line => 594,
value => _assert_fail,
start => 19100,
'end' => 19178,
pattern_start => 19111,
pattern_end => 19161})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1),
gleamgen@expression@constructor:new(none, Variant4@1),
gleamgen@expression@constructor:new(none, Variant5@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 612).
?DOC(
" Import a custom type with five variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type5(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PJN, {{{{{{}, PJO}, PJP}, PJQ},
PJR},
PJS}, PJY),
fun((gleamgen@type_@custom:custom_type(PJN, PJY), gleamgen@expression@constructor:constructor(PJN, PJO, PJY), gleamgen@expression@constructor:constructor(PJN, PJP, PJY), gleamgen@expression@constructor:constructor(PJN, PJQ, PJY), gleamgen@expression@constructor:constructor(PJN, PJR, PJY), gleamgen@expression@constructor:constructor(PJN, PJS, PJY)) -> module_())
) -> module_().
with_imported_custom_type5(Module, Name, Type_, Handler) ->
{Variant5@1, Variant4@1, Variant3@1, Variant2@1, Variant1@1} = case erlang:element(
2,
Type_
) of
[Variant5, Variant4, Variant3, Variant2, Variant1] -> {
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type5"/utf8>>,
line => 630,
value => _assert_fail,
start => 20289,
'end' => 20367,
pattern_start => 20300,
pattern_end => 20350})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1),
gleamgen@expression@constructor:new({some, Module}, Variant4@1),
gleamgen@expression@constructor:new({some, Module}, Variant5@1)
).
-file("src/gleamgen/module.gleam", 643).
?DOC(
" Define a custom type with six variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type6(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PKT, {{{{{{{}, PKU}, PKV}, PKW},
PKX},
PKY},
PKZ}, PLG),
fun((gleamgen@type_@custom:custom_type(PKT, PLG), gleamgen@expression@constructor:constructor(PKT, PKU, PLG), gleamgen@expression@constructor:constructor(PKT, PKV, PLG), gleamgen@expression@constructor:constructor(PKT, PKW, PLG), gleamgen@expression@constructor:constructor(PKT, PKX, PLG), gleamgen@expression@constructor:constructor(PKT, PKY, PLG), gleamgen@expression@constructor:constructor(PKT, PKZ, PLG)) -> module_())
) -> module_().
with_custom_type6(Details, Type_, Handler) ->
{Variant6@1, Variant5@1, Variant4@1, Variant3@1, Variant2@1, Variant1@1} = case erlang:element(
2,
Type_
) of
[Variant6, Variant5, Variant4, Variant3, Variant2, Variant1] -> {
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type6"/utf8>>,
line => 661,
value => _assert_fail,
start => 21337,
'end' => 21429,
pattern_start => 21348,
pattern_end => 21408})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1),
gleamgen@expression@constructor:new(none, Variant4@1),
gleamgen@expression@constructor:new(none, Variant5@1),
gleamgen@expression@constructor:new(none, Variant6@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 681).
?DOC(
" Import a custom type with six variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type6(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PME, {{{{{{{}, PMF}, PMG}, PMH},
PMI},
PMJ},
PMK}, PMR),
fun((gleamgen@type_@custom:custom_type(PME, PMR), gleamgen@expression@constructor:constructor(PME, PMF, PMR), gleamgen@expression@constructor:constructor(PME, PMG, PMR), gleamgen@expression@constructor:constructor(PME, PMH, PMR), gleamgen@expression@constructor:constructor(PME, PMI, PMR), gleamgen@expression@constructor:constructor(PME, PMJ, PMR), gleamgen@expression@constructor:constructor(PME, PMK, PMR)) -> module_())
) -> module_().
with_imported_custom_type6(Module, Name, Type_, Handler) ->
{Variant6@1, Variant5@1, Variant4@1, Variant3@1, Variant2@1, Variant1@1} = case erlang:element(
2,
Type_
) of
[Variant6, Variant5, Variant4, Variant3, Variant2, Variant1] -> {
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type6"/utf8>>,
line => 700,
value => _assert_fail,
start => 22636,
'end' => 22728,
pattern_start => 22647,
pattern_end => 22707})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1),
gleamgen@expression@constructor:new({some, Module}, Variant4@1),
gleamgen@expression@constructor:new({some, Module}, Variant5@1),
gleamgen@expression@constructor:new({some, Module}, Variant6@1)
).
-file("src/gleamgen/module.gleam", 715).
?DOC(
" Define a custom type with seven variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type7(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PNP, {{{{{{{{}, PNQ}, PNR}, PNS},
PNT},
PNU},
PNV},
PNW}, POE),
fun((gleamgen@type_@custom:custom_type(PNP, POE), gleamgen@expression@constructor:constructor(PNP, PNQ, POE), gleamgen@expression@constructor:constructor(PNP, PNR, POE), gleamgen@expression@constructor:constructor(PNP, PNS, POE), gleamgen@expression@constructor:constructor(PNP, PNT, POE), gleamgen@expression@constructor:constructor(PNP, PNU, POE), gleamgen@expression@constructor:constructor(PNP, PNV, POE), gleamgen@expression@constructor:constructor(PNP, PNW, POE)) -> module_())
) -> module_().
with_custom_type7(Details, Type_, Handler) ->
{
Variant7@1,
Variant6@1,
Variant5@1,
Variant4@1,
Variant3@1,
Variant2@1,
Variant1@1} = case erlang:element(2, Type_) of
[Variant7, Variant6, Variant5, Variant4, Variant3, Variant2, Variant1] -> {
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type7"/utf8>>,
line => 734,
value => _assert_fail,
start => 23803,
'end' => 23934,
pattern_start => 23814,
pattern_end => 23917})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1),
gleamgen@expression@constructor:new(none, Variant4@1),
gleamgen@expression@constructor:new(none, Variant5@1),
gleamgen@expression@constructor:new(none, Variant6@1),
gleamgen@expression@constructor:new(none, Variant7@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 762).
?DOC(
" Import a custom type with seven variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type7(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PPF, {{{{{{{{}, PPG}, PPH}, PPI},
PPJ},
PPK},
PPL},
PPM}, PPU),
fun((gleamgen@type_@custom:custom_type(PPF, PPU), gleamgen@expression@constructor:constructor(PPF, PPG, PPU), gleamgen@expression@constructor:constructor(PPF, PPH, PPU), gleamgen@expression@constructor:constructor(PPF, PPI, PPU), gleamgen@expression@constructor:constructor(PPF, PPJ, PPU), gleamgen@expression@constructor:constructor(PPF, PPK, PPU), gleamgen@expression@constructor:constructor(PPF, PPL, PPU), gleamgen@expression@constructor:constructor(PPF, PPM, PPU)) -> module_())
) -> module_().
with_imported_custom_type7(Module, Name, Type_, Handler) ->
{
Variant7@1,
Variant6@1,
Variant5@1,
Variant4@1,
Variant3@1,
Variant2@1,
Variant1@1} = case erlang:element(2, Type_) of
[Variant7, Variant6, Variant5, Variant4, Variant3, Variant2, Variant1] -> {
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type7"/utf8>>,
line => 782,
value => _assert_fail,
start => 25240,
'end' => 25371,
pattern_start => 25251,
pattern_end => 25354})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1),
gleamgen@expression@constructor:new({some, Module}, Variant4@1),
gleamgen@expression@constructor:new({some, Module}, Variant5@1),
gleamgen@expression@constructor:new({some, Module}, Variant6@1),
gleamgen@expression@constructor:new({some, Module}, Variant7@1)
).
-file("src/gleamgen/module.gleam", 805).
?DOC(
" Define a custom type with eight variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type8(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PQV, {{{{{{{{{}, PQW}, PQX}, PQY},
PQZ},
PRA},
PRB},
PRC},
PRD}, PRM),
fun((gleamgen@type_@custom:custom_type(PQV, PRM), gleamgen@expression@constructor:constructor(PQV, PQW, PRM), gleamgen@expression@constructor:constructor(PQV, PQX, PRM), gleamgen@expression@constructor:constructor(PQV, PQY, PRM), gleamgen@expression@constructor:constructor(PQV, PQZ, PRM), gleamgen@expression@constructor:constructor(PQV, PRA, PRM), gleamgen@expression@constructor:constructor(PQV, PRB, PRM), gleamgen@expression@constructor:constructor(PQV, PRC, PRM), gleamgen@expression@constructor:constructor(PQV, PRD, PRM)) -> module_())
) -> module_().
with_custom_type8(Details, Type_, Handler) ->
{
Variant8@1,
Variant7@1,
Variant6@1,
Variant5@1,
Variant4@1,
Variant3@1,
Variant2@1,
Variant1@1} = case erlang:element(2, Type_) of
[Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1] -> {
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type8"/utf8>>,
line => 825,
value => _assert_fail,
start => 26549,
'end' => 26694,
pattern_start => 26560,
pattern_end => 26677})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1),
gleamgen@expression@constructor:new(none, Variant4@1),
gleamgen@expression@constructor:new(none, Variant5@1),
gleamgen@expression@constructor:new(none, Variant6@1),
gleamgen@expression@constructor:new(none, Variant7@1),
gleamgen@expression@constructor:new(none, Variant8@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 855).
?DOC(
" Import a custom type with eight variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type8(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PSQ, {{{{{{{{{}, PSR}, PSS}, PST},
PSU},
PSV},
PSW},
PSX},
PSY}, PTH),
fun((gleamgen@type_@custom:custom_type(PSQ, PTH), gleamgen@expression@constructor:constructor(PSQ, PSR, PTH), gleamgen@expression@constructor:constructor(PSQ, PSS, PTH), gleamgen@expression@constructor:constructor(PSQ, PST, PTH), gleamgen@expression@constructor:constructor(PSQ, PSU, PTH), gleamgen@expression@constructor:constructor(PSQ, PSV, PTH), gleamgen@expression@constructor:constructor(PSQ, PSW, PTH), gleamgen@expression@constructor:constructor(PSQ, PSX, PTH), gleamgen@expression@constructor:constructor(PSQ, PSY, PTH)) -> module_())
) -> module_().
with_imported_custom_type8(Module, Name, Type_, Handler) ->
{
Variant8@1,
Variant7@1,
Variant6@1,
Variant5@1,
Variant4@1,
Variant3@1,
Variant2@1,
Variant1@1} = case erlang:element(2, Type_) of
[Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1] -> {
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type8"/utf8>>,
line => 876,
value => _assert_fail,
start => 28097,
'end' => 28242,
pattern_start => 28108,
pattern_end => 28225})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1),
gleamgen@expression@constructor:new({some, Module}, Variant4@1),
gleamgen@expression@constructor:new({some, Module}, Variant5@1),
gleamgen@expression@constructor:new({some, Module}, Variant6@1),
gleamgen@expression@constructor:new({some, Module}, Variant7@1),
gleamgen@expression@constructor:new({some, Module}, Variant8@1)
).
-file("src/gleamgen/module.gleam", 901).
?DOC(
" Define a custom type with nine variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type9(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PUL, {{{{{{{{{{}, PUM}, PUN}, PUO},
PUP},
PUQ},
PUR},
PUS},
PUT},
PUU}, PVE),
fun((gleamgen@type_@custom:custom_type(PUL, PVE), gleamgen@expression@constructor:constructor(PUL, PUM, PVE), gleamgen@expression@constructor:constructor(PUL, PUN, PVE), gleamgen@expression@constructor:constructor(PUL, PUO, PVE), gleamgen@expression@constructor:constructor(PUL, PUP, PVE), gleamgen@expression@constructor:constructor(PUL, PUQ, PVE), gleamgen@expression@constructor:constructor(PUL, PUR, PVE), gleamgen@expression@constructor:constructor(PUL, PUS, PVE), gleamgen@expression@constructor:constructor(PUL, PUT, PVE), gleamgen@expression@constructor:constructor(PUL, PUU, PVE)) -> module_())
) -> module_().
with_custom_type9(Details, Type_, Handler) ->
{
Variant9@1,
Variant8@1,
Variant7@1,
Variant6@1,
Variant5@1,
Variant4@1,
Variant3@1,
Variant2@1,
Variant1@1} = case erlang:element(2, Type_) of
[Variant9,
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1] -> {
Variant9,
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_custom_type9"/utf8>>,
line => 922,
value => _assert_fail,
start => 29522,
'end' => 29681,
pattern_start => 29533,
pattern_end => 29664})
end,
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
gleamgen@expression@constructor:new(none, Variant1@1),
gleamgen@expression@constructor:new(none, Variant2@1),
gleamgen@expression@constructor:new(none, Variant3@1),
gleamgen@expression@constructor:new(none, Variant4@1),
gleamgen@expression@constructor:new(none, Variant5@1),
gleamgen@expression@constructor:new(none, Variant6@1),
gleamgen@expression@constructor:new(none, Variant7@1),
gleamgen@expression@constructor:new(none, Variant8@1),
gleamgen@expression@constructor:new(none, Variant9@1)
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe = Type_,
gleamgen@type_@custom:to_dynamic(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 954).
?DOC(
" Import a custom type with nine variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type9(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PWL, {{{{{{{{{{}, PWM}, PWN}, PWO},
PWP},
PWQ},
PWR},
PWS},
PWT},
PWU}, PXE),
fun((gleamgen@type_@custom:custom_type(PWL, PXE), gleamgen@expression@constructor:constructor(PWL, PWM, PXE), gleamgen@expression@constructor:constructor(PWL, PWN, PXE), gleamgen@expression@constructor:constructor(PWL, PWO, PXE), gleamgen@expression@constructor:constructor(PWL, PWP, PXE), gleamgen@expression@constructor:constructor(PWL, PWQ, PXE), gleamgen@expression@constructor:constructor(PWL, PWR, PXE), gleamgen@expression@constructor:constructor(PWL, PWS, PXE), gleamgen@expression@constructor:constructor(PWL, PWT, PXE), gleamgen@expression@constructor:constructor(PWL, PWU, PXE)) -> module_())
) -> module_().
with_imported_custom_type9(Module, Name, Type_, Handler) ->
{
Variant9@1,
Variant8@1,
Variant7@1,
Variant6@1,
Variant5@1,
Variant4@1,
Variant3@1,
Variant2@1,
Variant1@1} = case erlang:element(2, Type_) of
[Variant9,
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1] -> {
Variant9,
Variant8,
Variant7,
Variant6,
Variant5,
Variant4,
Variant3,
Variant2,
Variant1};
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
file => <<?FILEPATH/utf8>>,
module => <<"gleamgen/module"/utf8>>,
function => <<"with_imported_custom_type9"/utf8>>,
line => 976,
value => _assert_fail,
start => 31180,
'end' => 31339,
pattern_start => 31191,
pattern_end => 31322})
end,
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
gleamgen@expression@constructor:new({some, Module}, Variant1@1),
gleamgen@expression@constructor:new({some, Module}, Variant2@1),
gleamgen@expression@constructor:new({some, Module}, Variant3@1),
gleamgen@expression@constructor:new({some, Module}, Variant4@1),
gleamgen@expression@constructor:new({some, Module}, Variant5@1),
gleamgen@expression@constructor:new({some, Module}, Variant6@1),
gleamgen@expression@constructor:new({some, Module}, Variant7@1),
gleamgen@expression@constructor:new({some, Module}, Variant8@1),
gleamgen@expression@constructor:new({some, Module}, Variant9@1)
).
-file("src/gleamgen/module.gleam", 1005).
?DOC(
" Define a custom type with a dynamic number of variants.\n"
" See [`with_custom_type1`](#with_custom_type1).\n"
).
-spec with_custom_type_dynamic(
gleamgen@module@definition:definition(),
gleamgen@type_@custom:custom_type_builder(PYL, gleamgen@type_:dynamic_(), PYM),
fun((gleamgen@type_@custom:custom_type(PYL, PYM), list(gleamgen@expression@constructor:constructor(PYL, gleamgen@type_:dynamic_(), PYM))) -> module_())
) -> module_().
with_custom_type_dynamic(Details, Type_, Handler) ->
Rest = Handler(
gleamgen@type_@custom:new_custom_type(
none,
gleamgen@module@definition:get_name(Details)
),
begin
_pipe = erlang:element(2, Type_),
_pipe@1 = lists:reverse(_pipe),
gleam@list:map(
_pipe@1,
fun(_capture) ->
gleamgen@expression@constructor:new(none, _capture)
end
)
end
),
{module,
[{definition,
Details,
{custom_type_builder,
begin
_pipe@2 = Type_,
gleamgen@type_@custom:to_dynamic(_pipe@2)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 1029).
?DOC(
" Import a custom type with a dynamic number of variants.\n"
" See [`with_imported_custom_type1`](#with_imported_custom_type1).\n"
).
-spec with_imported_custom_type_dynamic(
gleamgen@internal@import_reference:import_reference(),
binary(),
gleamgen@type_@custom:custom_type_builder(PYW, gleamgen@type_:dynamic_(), PYX),
fun((gleamgen@type_@custom:custom_type(PYW, PYX), list(gleamgen@expression@constructor:constructor(PYW, gleamgen@type_:dynamic_(), PYX))) -> module_())
) -> module_().
with_imported_custom_type_dynamic(Module, Name, Type_, Handler) ->
Handler(
gleamgen@type_@custom:new_custom_type({some, Module}, Name),
begin
_pipe = erlang:element(2, Type_),
_pipe@1 = lists:reverse(_pipe),
gleam@list:map(
_pipe@1,
fun(_capture) ->
gleamgen@expression@constructor:new(
{some, Module},
_capture
)
end
)
end
).
-file("src/gleamgen/module.gleam", 1047).
-spec with_type_alias(
gleamgen@module@definition:definition(),
gleamgen@type_:generated_type(PZH),
fun((gleamgen@type_:generated_type(PZH)) -> module_())
) -> module_().
with_type_alias(Details, Type_, Handler) ->
Rest = Handler(
gleamgen@type_:raw(gleamgen@module@definition:get_name(Details))
),
{module,
[{definition,
Details,
{type_alias,
begin
_pipe = Type_,
gleamgen_ffi:identity(_pipe)
end}} |
erlang:element(2, Rest)],
erlang:element(3, Rest),
erlang:element(4, Rest),
erlang:element(5, Rest)}.
-file("src/gleamgen/module.gleam", 1059).
-spec eof() -> module_().
eof() ->
{module, [], [], none, []}.
-file("src/gleamgen/module.gleam", 1229).
-spec separate_definitions(
list(module_definition()),
list(module_definition()),
list(module_definition()),
gleam@dict:dict(binary(), list(module_definition()))
) -> {list(module_definition()),
list(module_definition()),
gleam@dict:dict(binary(), list(module_definition()))}.
separate_definitions(Definitions, At_top, At_bottom, After_definition) ->
case Definitions of
[Definition | Rest] ->
case gleamgen@module@definition:get_position(
erlang:element(2, Definition)
) of
top ->
separate_definitions(
Rest,
[Definition | At_top],
At_bottom,
After_definition
);
bottom ->
separate_definitions(
Rest,
At_top,
[Definition | At_bottom],
After_definition
);
{after_definition, Def_name} ->
After_definition@1 = gleam@dict:upsert(
After_definition,
Def_name,
fun(Currently_after_definition) ->
case Currently_after_definition of
{some, List} ->
[Definition | List];
none ->
[Definition]
end
end
),
separate_definitions(
Rest,
At_top,
At_bottom,
After_definition@1
)
end;
[] ->
{At_top, At_bottom, After_definition}
end.
-file("src/gleamgen/module.gleam", 1149).
-spec render_imported_module(gleamgen@import_:imported_module()) -> gleamgen@internal@render:rendered().
render_imported_module(Module) ->
_pipe = glam@doc:concat(
[glam@doc:from_string(erlang:element(5, Module)),
glam@doc:from_string(<<"import "/utf8>>),
glam@doc:from_string(
gleam@string:join(erlang:element(2, Module), <<"/"/utf8>>)
),
case erlang:element(4, Module) of
[] ->
{concat, []};
Exposing ->
glam@doc:concat(
[glam@doc:from_string(<<".{"/utf8>>),
glam@doc:from_string(
gleamgen@import_:exposing_to_string(Exposing)
),
glam@doc:from_string(<<"}"/utf8>>)]
)
end,
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, [], [], {report, [], []}}}.
-file("src/gleamgen/module.gleam", 1277).
-spec render_definition(module_definition(), gleamgen@internal@render:context()) -> {glam@doc:document(),
gleamgen@internal@render:rendered_details()}.
render_definition(Definition, Context) ->
Name = gleamgen@module@definition:get_name(erlang:element(2, Definition)),
{Rendered@1, Details} = case erlang:element(3, Definition) of
{constant, Value} ->
Rendered_expr = gleamgen@expression:render(Value, Context),
{glam@doc:concat(
[glam@doc:from_string(<<"const "/utf8>>),
glam@doc:from_string(Name),
{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@type_@custom:render(Type_, Context),
{glam@doc:concat(
[glam@doc:from_string(<<"type "/utf8>>),
glam@doc:from_string(Name),
erlang:element(2, Rendered_type)]
),
erlang:element(3, Rendered_type)};
{type_alias, Type_@1} ->
Rendered_type@1 = gleamgen@type_:render_type(Type_@1, Context),
{glam@doc:concat(
[glam@doc:from_string(<<"type "/utf8>>),
glam@doc:from_string(Name),
{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, [], [], {report, [], []}}
)
end};
{function, Func} ->
Rendered = gleamgen@function:render(Func, Context, {some, Name}),
{erlang:element(2, Rendered), erlang:element(3, Rendered)};
{predefined, _, _, Content, _} ->
{glam@doc:from_string(Content),
{rendered_details, [], [], {report, [], []}}}
end,
Full_doc = begin
_pipe@4 = gleamgen@module@definition:create_base_definition(
erlang:element(2, Definition)
),
glam@doc:append(_pipe@4, Rendered@1)
end,
{Full_doc, Details}.
-file("src/gleamgen/module.gleam", 1178).
-spec render_all_definitions(
list(module_definition()),
gleam@dict:dict(binary(), list(module_definition())),
gleam@option:option(binary()),
gleamgen@internal@render:context(),
gleamgen@internal@render:rendered_details(),
list(glam@doc:document())
) -> {gleamgen@internal@render:rendered_details(), list(glam@doc:document())}.
render_all_definitions(
Definitions,
After_definition,
Last_definition_name,
Context,
Previous_details,
Rendered_definitions
) ->
Definitions_to_prepend = begin
_pipe = Last_definition_name,
gleam@option:then(
_pipe,
fun(Name) -> case gleam_stdlib:map_get(After_definition, Name) of
{ok, Defs} ->
{some,
{Defs, gleam@dict:delete(After_definition, Name)}};
{error, _} ->
none
end end
)
end,
case Definitions_to_prepend of
{some, {Defs@1, New_after_definition}} ->
render_all_definitions(
lists:append(Defs@1, Definitions),
New_after_definition,
none,
Context,
Previous_details,
Rendered_definitions
);
none ->
case Definitions of
[Definition | Rest] ->
{Rendered_def, New_details} = render_definition(
Definition,
Context
),
render_all_definitions(
Rest,
After_definition,
{some,
gleamgen@module@definition:get_name(
erlang:element(2, Definition)
)},
Context,
gleamgen@internal@render:merge_details(
Previous_details,
New_details
),
[Rendered_def | Rendered_definitions]
);
[] ->
{Previous_details, lists:reverse(Rendered_definitions)}
end
end.
-file("src/gleamgen/module.gleam", 1063).
-spec render(module_(), gleamgen@internal@render:context()) -> gleamgen@internal@render:rendered().
render(Module, Context) ->
{Definitions_at_top, Definitions_at_bottom, Definitions_after} = separate_definitions(
erlang:element(2, Module),
[],
[],
maps:new()
),
External_definitions = case erlang:element(4, Module) of
{some, External} ->
erlang:element(3, External);
none ->
[]
end,
All_definitions = begin
_pipe = [Definitions_at_bottom,
External_definitions,
Definitions_at_top],
_pipe@1 = lists:append(_pipe),
lists:reverse(_pipe@1)
end,
Import_references = gleam@list:map(
erlang:element(3, Module),
fun gleamgen@import_:import_to_reference/1
),
Context@1 = {context,
erlang:element(2, Context),
Import_references,
erlang:element(4, Context)},
{Details, Rendered_defs} = render_all_definitions(
All_definitions,
Definitions_after,
none,
Context@1,
{rendered_details, [], [], {report, [], []}},
[]
),
Implied_imports = begin
_pipe@2 = erlang:element(3, Details),
gleam@list:map(
_pipe@2,
fun(Module@1) -> _pipe@3 = gleamgen@import_:new(Module@1),
gleamgen@import_:with_predefined(_pipe@3, true) end
)
end,
Rendered_imports = begin
_pipe@4 = erlang:element(3, Module),
_pipe@5 = lists:append(_pipe@4, Implied_imports),
_pipe@6 = gleam@list:sort(_pipe@5, fun gleamgen@import_:compare/2),
_pipe@7 = gleamgen@import_:merge_imports(_pipe@6),
_pipe@8 = gleam@list:filter(
_pipe@7,
fun(M) ->
(erlang:element(6, M) orelse not gleam@list:is_empty(
erlang:element(4, M)
))
orelse gleam@list:contains(
erlang:element(2, Details),
gleamgen@internal@import_reference:get_module_representation(
gleamgen@import_:import_to_reference(M)
)
)
end
),
_pipe@11 = gleam@list:map(_pipe@8, fun(X) -> _pipe@9 = X,
_pipe@10 = render_imported_module(_pipe@9),
gleamgen@internal@render:to_string(_pipe@10) end),
gleam@list:map(_pipe@11, fun glam@doc:from_string/1)
end,
Documentation_comments = begin
_pipe@12 = glam@doc:join(
gleam@list:map(
erlang:element(5, Module),
fun(Comment) ->
glam@doc:from_string(<<"//// "/utf8, Comment/binary>>)
end
),
{line, 1}
),
glam@doc:append(
_pipe@12,
case {erlang:element(5, Module), Rendered_imports} of
{[], _} ->
{concat, []};
{_, []} ->
{concat, []};
{_, _} ->
{line, 1}
end
)
end,
_pipe@13 = Rendered_imports,
_pipe@14 = glam@doc:join(_pipe@13, {line, 1}),
_pipe@15 = glam@doc:prepend(_pipe@14, Documentation_comments),
_pipe@16 = glam@doc:append(
_pipe@15,
case gleam@list:is_empty(Rendered_imports) andalso gleam@list:is_empty(
erlang:element(5, Module)
) of
true ->
{concat, []};
false ->
glam@doc:concat([{line, 1}, {line, 1}])
end
),
_pipe@17 = glam@doc:append(
_pipe@16,
glam@doc:concat_join(Rendered_defs, [{line, 1}, {line, 1}])
),
{render, _pipe@17, Details}.