Skip to content

Commit

Permalink
♻️ concat some things
Browse files Browse the repository at this point in the history
  • Loading branch information
MystPi committed Mar 5, 2024
1 parent 86861e7 commit 9db16a0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/pprint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ fn pretty_dict(d: Dict(decoder.Type, decoder.Type), config: Config) -> Document
|> list.map(fn(field) {
// Format the dict's items into tuple literals
[
doc.from_string("#("),
pretty_type(field.0, config),
doc.from_string(", "),
pretty_type(field.1, config),
doc.from_string(")"),
]
|> doc.concat
|> doc.prepend(doc.from_string("#("))
|> doc.append(doc.from_string(")"))
})
|> doc.concat_join([doc.from_string(","), doc.space])
|> wrap(
Expand Down Expand Up @@ -275,10 +275,7 @@ fn pretty_custom_type(
// ]
// )
//
[single] ->
single
|> doc.prepend(open)
|> doc.append(close)
[single] -> doc.concat([open, single, close])
// However, multiple fields are indented because they would look weird otherwise.
_ ->
fields
Expand Down

0 comments on commit 9db16a0

Please sign in to comment.