Current section

Files

Jump to
tallgrass src internal@common@pokemon.erl
Raw

src/internal@common@pokemon.erl

-module(internal@common@pokemon).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([pokemon/0, pokemon_with_hidden/0]).
-export_type([pokemon/0, pokemon_with_hidden/0]).
-type pokemon() :: {pokemon, integer(), internal@common@affordance:affordance()}.
-type pokemon_with_hidden() :: {pokemon_with_hidden,
boolean(),
integer(),
internal@common@affordance:affordance()}.
-spec pokemon() -> decode:decoder(pokemon()).
pokemon() ->
_pipe = decode:into(
(decode:parameter(
fun(Slot) ->
decode:parameter(fun(Pokemon) -> {pokemon, Slot, Pokemon} end)
end
))
),
_pipe@1 = decode:field(
_pipe,
<<"slot"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
decode:field(
_pipe@1,
<<"pokemon"/utf8>>,
internal@common@affordance:affordance()
).
-spec pokemon_with_hidden() -> decode:decoder(pokemon_with_hidden()).
pokemon_with_hidden() ->
_pipe = decode:into(
(decode:parameter(
fun(Is_hidden) ->
decode:parameter(
fun(Slot) ->
decode:parameter(
fun(Pokemon) ->
{pokemon_with_hidden, Is_hidden, Slot, Pokemon}
end
)
end
)
end
))
),
_pipe@1 = decode:field(
_pipe,
<<"is_hidden"/utf8>>,
{decoder, fun gleam@dynamic:bool/1}
),
_pipe@2 = decode:field(
_pipe@1,
<<"slot"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
decode:field(
_pipe@2,
<<"pokemon"/utf8>>,
internal@common@affordance:affordance()
).