Work around roc format bug

This commit is contained in:
Richard Feldman 2023-08-11 01:48:54 -04:00
parent 9b8d8e85e7
commit 60bbd33f8b
No known key found for this signature in database
GPG Key ID: F1F21AA5B1D9E43B

View File

@ -121,25 +121,27 @@ inspectPerson = \@Person { firstName, lastName, age, hasBeard, favoriteColor } -
# This is what the auto-derive would generate. # This is what the auto-derive would generate.
f0 <- Inspect.custom f0 <- Inspect.custom
favoriteColorTag =
when favoriteColor is
Red ->
Inspect.tag "Red" []
Green ->
Inspect.tag "Green" []
Blue ->
Inspect.tag "Blue" []
RGB (r, g, b) ->
Inspect.tag "RGB" [Inspect.tuple [Inspect.u8 r, Inspect.u8 g, Inspect.u8 b]]
[ [
{ key: "firstName", value: Inspect.str firstName }, { key: "firstName", value: Inspect.str firstName },
{ key: "lastName", value: Inspect.str lastName }, { key: "lastName", value: Inspect.str lastName },
{ key: "age", value: Inspect.u8 age }, { key: "age", value: Inspect.u8 age },
{ key: "hasBeard", value: Inspect.bool hasBeard }, { key: "hasBeard", value: Inspect.bool hasBeard },
{ { key: "favoriteColor", value: favoriteColorTag },
key: "favoriteColor",
value:
when favoriteColor is
Red ->
Inspect.tag "Red" []
Green ->
Inspect.tag "Green" []
Blue ->
Inspect.tag "Blue" []
RGB (r, g, b) ->
Inspect.tag "RGB" [Inspect.tuple [Inspect.u8 r, Inspect.u8 g, Inspect.u8 b]]
,
},
] ]
|> Inspect.record |> Inspect.record
|> Inspect.apply f0 |> Inspect.apply f0