aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.erl
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2023-11-11 23:13:01 +0000
committerLouis Pilfold <louis@lpil.uk>2023-11-11 23:13:01 +0000
commit0bcd8c145988e7a5baf8983262e7d17b24159944 (patch)
tree61d288c963a19d1d8feb70f5e36b084bb6494956 /src/gleam_stdlib.erl
parent5f0a4a01f9650f00398b5b4fdf10447ad667afda (diff)
downloadgleam_stdlib-0bcd8c145988e7a5baf8983262e7d17b24159944.tar.gz
gleam_stdlib-0bcd8c145988e7a5baf8983262e7d17b24159944.zip
Improve string inspect map formatting
Diffstat (limited to 'src/gleam_stdlib.erl')
-rw-r--r--src/gleam_stdlib.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gleam_stdlib.erl b/src/gleam_stdlib.erl
index c6b5130..7414439 100644
--- a/src/gleam_stdlib.erl
+++ b/src/gleam_stdlib.erl
@@ -373,6 +373,12 @@ inspect(false) ->
"False";
inspect(nil) ->
"Nil";
+inspect(Data) when is_map(Data) ->
+ Fields = [
+ [<<"#(">>, inspect(Key), <<", ">>, inspect(Value), <<")">>]
+ || {Key, Value} <- maps:to_list(Data)
+ ],
+ ["map.from_list([", lists:join(", ", Fields), "])"];
inspect(Atom) when is_atom(Atom) ->
Binary = erlang:atom_to_binary(Atom),
case inspect_maybe_gleam_atom(Binary, none, <<>>) of