That is, the construct asserts a 'singleton map' (only one map key), essentially working like a tagged tuple. This can be used to provide a dictionary of valid message types, each 'tagged' with a 'singleton map'.
(One could imagine letting the pattern work on records as well, but nyi).
Test case illustrates:
```erlang
t_switch() ->
T = #{switch => #{a => int, b => binary}},
t_round_trip_typed(T, #{a => 17}),
t_round_trip_typed(T, #{b => <<"foo">>}),
?assertError({illegal,int,<<"foo">>}, encode_typed(T, #{a => <<"foo">>})),
MMap = #{a => 17, b => <<"foo">>},
?assertError({illegal, singleton_map, MMap}, encode_typed(T, MMap)).
```
That is, the construct asserts a 'singleton map' (only one map key), essentially working like a tagged tuple. This can be used to provide a dictionary of valid message types, each 'tagged' with a 'singleton map'.
(One could imagine letting the pattern work on records as well, but nyi).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Test case illustrates:
That is, the construct asserts a 'singleton map' (only one map key), essentially working like a tagged tuple. This can be used to provide a dictionary of valid message types, each 'tagged' with a 'singleton map'.
(One could imagine letting the pattern work on records as well, but nyi).
The PR also adds version-controlled type management, and the
gmser_dyn_typesmodule provides some slightly improved ways to define a type map.Example of Types expansion (e.g. for sending to a client):
Note how the template funs for types
fooandbarhave been expanded, using the embeddedvsnattribute.