-module(gleam@dynamic). -compile([no_auto_import, nowarn_unused_vars]). -export([dynamic/1, decode1/2, from/1, unsafe_coerce/1, bit_string/1, classify/1, int/1, float/1, bool/1, shallow_list/1, optional/1, result/2, any/1, string/1, list/1, field/2, optional_field/2, element/2, tuple2/2, tuple3/3, tuple4/4, tuple5/5, tuple6/6, map/2, decode2/3, decode3/4, decode4/5, decode5/6, decode6/7, decode7/8, decode8/9, decode9/10]). -export_type([decode_error/0, dynamic/0, unknown_tuple/0]). -type decode_error() :: {decode_error, binary(), binary(), list(binary())}. -type dynamic() :: any(). -type unknown_tuple() :: any(). -spec dynamic(dynamic()) -> {ok, dynamic()} | {error, list(decode_error())}. dynamic(Value) -> {ok, Value}. -spec put_expected(decode_error(), binary()) -> decode_error(). put_expected(Error, Expected) -> erlang:setelement(2, Error, Expected). -spec all_errors({ok, any()} | {error, list(decode_error())}) -> list(decode_error()). all_errors(Result) -> case Result of {ok, _} -> []; {error, Errors} -> Errors end. -spec decode1( fun((BWE) -> BWF), fun((dynamic()) -> {ok, BWE} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BWF} | {error, list(decode_error())}). decode1(Constructor, T1) -> fun(Value) -> case T1(Value) of {ok, A} -> {ok, Constructor(A)}; A@1 -> {error, all_errors(A@1)} end end. -spec from(any()) -> dynamic(). from(A) -> gleam_stdlib:identity(A). -spec unsafe_coerce(dynamic()) -> any(). unsafe_coerce(A) -> gleam_stdlib:identity(A). -spec bit_string(dynamic()) -> {ok, bitstring()} | {error, list(decode_error())}. bit_string(Data) -> gleam_stdlib:decode_bit_string(Data). -spec classify(dynamic()) -> binary(). classify(Data) -> gleam_stdlib:classify_dynamic(Data). -spec int(dynamic()) -> {ok, integer()} | {error, list(decode_error())}. int(Data) -> gleam_stdlib:decode_int(Data). -spec at_least_decode_tuple_error(integer(), dynamic()) -> {ok, any()} | {error, list(decode_error())}. at_least_decode_tuple_error(Size, Data) -> S = case Size of 1 -> <<""/utf8>>; _ -> <<"s"/utf8>> end, Error = begin _pipe = [<<"Tuple of at least "/utf8>>, gleam@int:to_string(Size), <<" element"/utf8>>, S], _pipe@1 = gleam@string_builder:from_strings(_pipe), _pipe@2 = gleam@string_builder:to_string(_pipe@1), {decode_error, _pipe@2, classify(Data), []} end, {error, [Error]}. -spec float(dynamic()) -> {ok, float()} | {error, list(decode_error())}. float(Data) -> gleam_stdlib:decode_float(Data). -spec bool(dynamic()) -> {ok, boolean()} | {error, list(decode_error())}. bool(Data) -> gleam_stdlib:decode_bool(Data). -spec shallow_list(dynamic()) -> {ok, list(dynamic())} | {error, list(decode_error())}. shallow_list(Value) -> gleam_stdlib:decode_list(Value). -spec optional(fun((dynamic()) -> {ok, BTB} | {error, list(decode_error())})) -> fun((dynamic()) -> {ok, gleam@option:option(BTB)} | {error, list(decode_error())}). optional(Decode) -> fun(Value) -> gleam_stdlib:decode_option(Value, Decode) end. -spec result( fun((dynamic()) -> {ok, BSP} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BSR} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, {ok, BSP} | {error, BSR}} | {error, list(decode_error())}). result(Decode_ok, Decode_error) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_result(Value), fun(Inner_result) -> case Inner_result of {ok, Raw} -> gleam@result:'try'( begin _pipe = Decode_ok(Raw), map_errors( _pipe, fun(_capture) -> push_path(_capture, <<"ok"/utf8>>) end ) end, fun(Value@1) -> {ok, {ok, Value@1}} end ); {error, Raw@1} -> gleam@result:'try'( begin _pipe@1 = Decode_error(Raw@1), map_errors( _pipe@1, fun(_capture@1) -> push_path(_capture@1, <<"error"/utf8>>) end ) end, fun(Value@2) -> {ok, {error, Value@2}} end ) end end ) end. -spec any(list(fun((dynamic()) -> {ok, BWA} | {error, list(decode_error())}))) -> fun((dynamic()) -> {ok, BWA} | {error, list(decode_error())}). any(Decoders) -> fun(Data) -> case Decoders of [] -> {error, [{decode_error, <<"another type"/utf8>>, classify(Data), []}]}; [Decoder | Decoders@1] -> case Decoder(Data) of {ok, Decoded} -> {ok, Decoded}; {error, _} -> (any(Decoders@1))(Data) end end end. -spec push_path(decode_error(), any()) -> decode_error(). push_path(Error, Name) -> Name@1 = from(Name), Decoder = any( [fun string/1, fun(X) -> gleam@result:map(int(X), fun gleam@int:to_string/1) end] ), Name@3 = case Decoder(Name@1) of {ok, Name@2} -> Name@2; {error, _} -> _pipe = [<<"<"/utf8>>, classify(Name@1), <<">"/utf8>>], _pipe@1 = gleam@string_builder:from_strings(_pipe), gleam@string_builder:to_string(_pipe@1) end, erlang:setelement(4, Error, [Name@3 | erlang:element(4, Error)]). -spec string(dynamic()) -> {ok, binary()} | {error, list(decode_error())}. string(Data) -> decode_string(Data). -spec decode_string(dynamic()) -> {ok, binary()} | {error, list(decode_error())}. decode_string(Data) -> _pipe = bit_string(Data), _pipe@1 = map_errors( _pipe, fun(_capture) -> put_expected(_capture, <<"String"/utf8>>) end ), gleam@result:'try'( _pipe@1, fun(Raw) -> case gleam@bit_string:to_string(Raw) of {ok, String} -> {ok, String}; {error, nil} -> {error, [{decode_error, <<"String"/utf8>>, <<"BitString"/utf8>>, []}]} end end ). -spec map_errors( {ok, BRZ} | {error, list(decode_error())}, fun((decode_error()) -> decode_error()) ) -> {ok, BRZ} | {error, list(decode_error())}. map_errors(Result, F) -> gleam@result:map_error( Result, fun(_capture) -> gleam@list:map(_capture, F) end ). -spec list(fun((dynamic()) -> {ok, BSW} | {error, list(decode_error())})) -> fun((dynamic()) -> {ok, list(BSW)} | {error, list(decode_error())}). list(Decoder_type) -> fun(Dynamic) -> gleam@result:'try'(shallow_list(Dynamic), fun(List) -> _pipe = List, _pipe@1 = gleam@list:try_map(_pipe, Decoder_type), map_errors( _pipe@1, fun(_capture) -> push_path(_capture, <<"*"/utf8>>) end ) end) end. -spec field( any(), fun((dynamic()) -> {ok, BTG} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BTG} | {error, list(decode_error())}). field(Name, Inner_type) -> fun(Value) -> Missing_field_error = {decode_error, <<"field"/utf8>>, <<"nothing"/utf8>>, []}, gleam@result:'try'( gleam_stdlib:decode_field(Value, Name), fun(Maybe_inner) -> _pipe = Maybe_inner, _pipe@1 = gleam@option:to_result(_pipe, [Missing_field_error]), _pipe@2 = gleam@result:'try'(_pipe@1, Inner_type), map_errors( _pipe@2, fun(_capture) -> push_path(_capture, Name) end ) end ) end. -spec optional_field( any(), fun((dynamic()) -> {ok, BTK} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, gleam@option:option(BTK)} | {error, list(decode_error())}). optional_field(Name, Inner_type) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_field(Value, Name), fun(Maybe_inner) -> case Maybe_inner of none -> {ok, none}; {some, Dynamic_inner} -> _pipe = Dynamic_inner, _pipe@1 = gleam_stdlib:decode_option(_pipe, Inner_type), map_errors( _pipe@1, fun(_capture) -> push_path(_capture, Name) end ) end end ) end. -spec element( integer(), fun((dynamic()) -> {ok, BTO} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BTO} | {error, list(decode_error())}). element(Index, Inner_type) -> fun(Data) -> gleam@result:'try'( gleam_stdlib:decode_tuple(Data), fun(Tuple) -> Size = gleam_stdlib:size_of_tuple(Tuple), gleam@result:'try'(case Index >= 0 of true -> case Index < Size of true -> gleam_stdlib:tuple_get(Tuple, Index); false -> at_least_decode_tuple_error(Index + 1, Data) end; false -> case gleam@int:absolute_value(Index) =< Size of true -> gleam_stdlib:tuple_get(Tuple, Size + Index); false -> at_least_decode_tuple_error( gleam@int:absolute_value(Index), Data ) end end, fun(Data@1) -> _pipe = Inner_type(Data@1), map_errors( _pipe, fun(_capture) -> push_path(_capture, Index) end ) end) end ) end. -spec tuple_errors({ok, any()} | {error, list(decode_error())}, binary()) -> list(decode_error()). tuple_errors(Result, Name) -> case Result of {ok, _} -> []; {error, Errors} -> gleam@list:map( Errors, fun(_capture) -> push_path(_capture, Name) end ) end. -spec tuple2( fun((dynamic()) -> {ok, BUA} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUC} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, {BUA, BUC}} | {error, list(decode_error())}). tuple2(Decode1, Decode2) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_tuple2(Value), fun(_use0) -> {A, B} = _use0, case {Decode1(A), Decode2(B)} of {{ok, A@1}, {ok, B@1}} -> {ok, {A@1, B@1}}; {A@2, B@2} -> _pipe = tuple_errors(A@2, <<"0"/utf8>>), _pipe@1 = gleam@list:append( _pipe, tuple_errors(B@2, <<"1"/utf8>>) ), {error, _pipe@1} end end ) end. -spec tuple3( fun((dynamic()) -> {ok, BUF} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUH} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUJ} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, {BUF, BUH, BUJ}} | {error, list(decode_error())}). tuple3(Decode1, Decode2, Decode3) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_tuple3(Value), fun(_use0) -> {A, B, C} = _use0, case {Decode1(A), Decode2(B), Decode3(C)} of {{ok, A@1}, {ok, B@1}, {ok, C@1}} -> {ok, {A@1, B@1, C@1}}; {A@2, B@2, C@2} -> _pipe = tuple_errors(A@2, <<"0"/utf8>>), _pipe@1 = gleam@list:append( _pipe, tuple_errors(B@2, <<"1"/utf8>>) ), _pipe@2 = gleam@list:append( _pipe@1, tuple_errors(C@2, <<"2"/utf8>>) ), {error, _pipe@2} end end ) end. -spec tuple4( fun((dynamic()) -> {ok, BUM} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUO} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUQ} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUS} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, {BUM, BUO, BUQ, BUS}} | {error, list(decode_error())}). tuple4(Decode1, Decode2, Decode3, Decode4) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_tuple4(Value), fun(_use0) -> {A, B, C, D} = _use0, case {Decode1(A), Decode2(B), Decode3(C), Decode4(D)} of {{ok, A@1}, {ok, B@1}, {ok, C@1}, {ok, D@1}} -> {ok, {A@1, B@1, C@1, D@1}}; {A@2, B@2, C@2, D@2} -> _pipe = tuple_errors(A@2, <<"0"/utf8>>), _pipe@1 = gleam@list:append( _pipe, tuple_errors(B@2, <<"1"/utf8>>) ), _pipe@2 = gleam@list:append( _pipe@1, tuple_errors(C@2, <<"2"/utf8>>) ), _pipe@3 = gleam@list:append( _pipe@2, tuple_errors(D@2, <<"3"/utf8>>) ), {error, _pipe@3} end end ) end. -spec tuple5( fun((dynamic()) -> {ok, BUV} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUX} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BUZ} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVB} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVD} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, {BUV, BUX, BUZ, BVB, BVD}} | {error, list(decode_error())}). tuple5(Decode1, Decode2, Decode3, Decode4, Decode5) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_tuple5(Value), fun(_use0) -> {A, B, C, D, E} = _use0, case {Decode1(A), Decode2(B), Decode3(C), Decode4(D), Decode5(E)} of {{ok, A@1}, {ok, B@1}, {ok, C@1}, {ok, D@1}, {ok, E@1}} -> {ok, {A@1, B@1, C@1, D@1, E@1}}; {A@2, B@2, C@2, D@2, E@2} -> _pipe = tuple_errors(A@2, <<"0"/utf8>>), _pipe@1 = gleam@list:append( _pipe, tuple_errors(B@2, <<"1"/utf8>>) ), _pipe@2 = gleam@list:append( _pipe@1, tuple_errors(C@2, <<"2"/utf8>>) ), _pipe@3 = gleam@list:append( _pipe@2, tuple_errors(D@2, <<"3"/utf8>>) ), _pipe@4 = gleam@list:append( _pipe@3, tuple_errors(E@2, <<"4"/utf8>>) ), {error, _pipe@4} end end ) end. -spec tuple6( fun((dynamic()) -> {ok, BVG} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVI} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVK} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVM} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVO} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVQ} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, {BVG, BVI, BVK, BVM, BVO, BVQ}} | {error, list(decode_error())}). tuple6(Decode1, Decode2, Decode3, Decode4, Decode5, Decode6) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_tuple6(Value), fun(_use0) -> {A, B, C, D, E, F} = _use0, case {Decode1(A), Decode2(B), Decode3(C), Decode4(D), Decode5(E), Decode6(F)} of {{ok, A@1}, {ok, B@1}, {ok, C@1}, {ok, D@1}, {ok, E@1}, {ok, F@1}} -> {ok, {A@1, B@1, C@1, D@1, E@1, F@1}}; {A@2, B@2, C@2, D@2, E@2, F@2} -> _pipe = tuple_errors(A@2, <<"0"/utf8>>), _pipe@1 = gleam@list:append( _pipe, tuple_errors(B@2, <<"1"/utf8>>) ), _pipe@2 = gleam@list:append( _pipe@1, tuple_errors(C@2, <<"2"/utf8>>) ), _pipe@3 = gleam@list:append( _pipe@2, tuple_errors(D@2, <<"3"/utf8>>) ), _pipe@4 = gleam@list:append( _pipe@3, tuple_errors(E@2, <<"4"/utf8>>) ), _pipe@5 = gleam@list:append( _pipe@4, tuple_errors(F@2, <<"5"/utf8>>) ), {error, _pipe@5} end end ) end. -spec map( fun((dynamic()) -> {ok, BVT} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BVV} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, gleam@map:map_(BVT, BVV)} | {error, list(decode_error())}). map(Key_type, Value_type) -> fun(Value) -> gleam@result:'try'( gleam_stdlib:decode_map(Value), fun(Map) -> gleam@result:'try'( begin _pipe = Map, _pipe@1 = gleam@map:to_list(_pipe), gleam@list:try_map( _pipe@1, fun(Pair) -> {K, V} = Pair, gleam@result:'try'( begin _pipe@2 = Key_type(K), map_errors( _pipe@2, fun(_capture) -> push_path( _capture, <<"keys"/utf8>> ) end ) end, fun(K@1) -> gleam@result:'try'( begin _pipe@3 = Value_type(V), map_errors( _pipe@3, fun(_capture@1) -> push_path( _capture@1, <<"values"/utf8>> ) end ) end, fun(V@1) -> {ok, {K@1, V@1}} end ) end ) end ) end, fun(Pairs) -> {ok, gleam@map:from_list(Pairs)} end ) end ) end. -spec decode2( fun((BWI, BWJ) -> BWK), fun((dynamic()) -> {ok, BWI} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BWJ} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BWK} | {error, list(decode_error())}). decode2(Constructor, T1, T2) -> fun(Value) -> case {T1(Value), T2(Value)} of {{ok, A}, {ok, B}} -> {ok, Constructor(A, B)}; {A@1, B@1} -> {error, gleam@list:flatten([all_errors(A@1), all_errors(B@1)])} end end. -spec decode3( fun((BWO, BWP, BWQ) -> BWR), fun((dynamic()) -> {ok, BWO} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BWP} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BWQ} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BWR} | {error, list(decode_error())}). decode3(Constructor, T1, T2, T3) -> fun(Value) -> case {T1(Value), T2(Value), T3(Value)} of {{ok, A}, {ok, B}, {ok, C}} -> {ok, Constructor(A, B, C)}; {A@1, B@1, C@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1)] )} end end. -spec decode4( fun((BWW, BWX, BWY, BWZ) -> BXA), fun((dynamic()) -> {ok, BWW} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BWX} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BWY} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BWZ} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BXA} | {error, list(decode_error())}). decode4(Constructor, T1, T2, T3, T4) -> fun(X) -> case {T1(X), T2(X), T3(X), T4(X)} of {{ok, A}, {ok, B}, {ok, C}, {ok, D}} -> {ok, Constructor(A, B, C, D)}; {A@1, B@1, C@1, D@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1), all_errors(D@1)] )} end end. -spec decode5( fun((BXG, BXH, BXI, BXJ, BXK) -> BXL), fun((dynamic()) -> {ok, BXG} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXH} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXI} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXJ} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXK} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BXL} | {error, list(decode_error())}). decode5(Constructor, T1, T2, T3, T4, T5) -> fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X)} of {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}} -> {ok, Constructor(A, B, C, D, E)}; {A@1, B@1, C@1, D@1, E@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1), all_errors(D@1), all_errors(E@1)] )} end end. -spec decode6( fun((BXS, BXT, BXU, BXV, BXW, BXX) -> BXY), fun((dynamic()) -> {ok, BXS} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXT} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXU} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXV} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXW} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BXX} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BXY} | {error, list(decode_error())}). decode6(Constructor, T1, T2, T3, T4, T5, T6) -> fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X)} of {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}, {ok, F}} -> {ok, Constructor(A, B, C, D, E, F)}; {A@1, B@1, C@1, D@1, E@1, F@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1), all_errors(D@1), all_errors(E@1), all_errors(F@1)] )} end end. -spec decode7( fun((BYG, BYH, BYI, BYJ, BYK, BYL, BYM) -> BYN), fun((dynamic()) -> {ok, BYG} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYH} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYI} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYJ} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYK} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYL} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYM} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BYN} | {error, list(decode_error())}). decode7(Constructor, T1, T2, T3, T4, T5, T6, T7) -> fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X), T7(X)} of {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}, {ok, F}, {ok, G}} -> {ok, Constructor(A, B, C, D, E, F, G)}; {A@1, B@1, C@1, D@1, E@1, F@1, G@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1), all_errors(D@1), all_errors(E@1), all_errors(F@1), all_errors(G@1)] )} end end. -spec decode8( fun((BYW, BYX, BYY, BYZ, BZA, BZB, BZC, BZD) -> BZE), fun((dynamic()) -> {ok, BYW} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYX} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYY} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BYZ} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZA} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZB} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZC} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZD} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BZE} | {error, list(decode_error())}). decode8(Constructor, T1, T2, T3, T4, T5, T6, T7, T8) -> fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X), T7(X), T8(X)} of {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}, {ok, F}, {ok, G}, {ok, H}} -> {ok, Constructor(A, B, C, D, E, F, G, H)}; {A@1, B@1, C@1, D@1, E@1, F@1, G@1, H@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1), all_errors(D@1), all_errors(E@1), all_errors(F@1), all_errors(G@1), all_errors(H@1)] )} end end. -spec decode9( fun((BZO, BZP, BZQ, BZR, BZS, BZT, BZU, BZV, BZW) -> BZX), fun((dynamic()) -> {ok, BZO} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZP} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZQ} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZR} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZS} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZT} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZU} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZV} | {error, list(decode_error())}), fun((dynamic()) -> {ok, BZW} | {error, list(decode_error())}) ) -> fun((dynamic()) -> {ok, BZX} | {error, list(decode_error())}). decode9(Constructor, T1, T2, T3, T4, T5, T6, T7, T8, T9) -> fun(X) -> case {T1(X), T2(X), T3(X), T4(X), T5(X), T6(X), T7(X), T8(X), T9(X)} of {{ok, A}, {ok, B}, {ok, C}, {ok, D}, {ok, E}, {ok, F}, {ok, G}, {ok, H}, {ok, I}} -> {ok, Constructor(A, B, C, D, E, F, G, H, I)}; {A@1, B@1, C@1, D@1, E@1, F@1, G@1, H@1, I@1} -> {error, gleam@list:flatten( [all_errors(A@1), all_errors(B@1), all_errors(C@1), all_errors(D@1), all_errors(E@1), all_errors(F@1), all_errors(G@1), all_errors(H@1), all_errors(I@1)] )} end end.