aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Jones <m.pricejones@gmail.com>2021-08-11 21:12:03 +0100
committerLouis Pilfold <louis@lpil.uk>2021-08-13 18:13:35 +0100
commit4d148445a25eb61e5e22da1cce9dec7099efb849 (patch)
tree5f74785745f1bebf67752de52eba8f45ad3de7b7 /src
parent92b10faf136eef38dab572a247435c9393638ab1 (diff)
downloadgleam_stdlib-4d148445a25eb61e5e22da1cce9dec7099efb849.tar.gz
gleam_stdlib-4d148445a25eb61e5e22da1cce9dec7099efb849.zip
Use spread syntax for field override
Co-authored-by: Louis Pilfold <louis@lpil.uk>
Diffstat (limited to 'src')
-rw-r--r--src/gleam/dynamic.gleam8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/gleam/dynamic.gleam b/src/gleam/dynamic.gleam
index 890b44d..bf6afd1 100644
--- a/src/gleam/dynamic.gleam
+++ b/src/gleam/dynamic.gleam
@@ -61,13 +61,7 @@ if erlang {
///
pub fn string(from: Dynamic) -> Result(String, DecodeError) {
bit_string(from)
- |> result.map_error(fn(error) {
- case error {
- DecodeError(_expected, found) ->
- // Convert error so it doesn't say expected 'BitString'
- DecodeError(expected: "String", found: found)
- }
- })
+ |> result.map_error(fn(error) { DecodeError(..error, expected: "String") })
|> result.then(fn(raw) {
case bit_string.to_string(raw) {
Ok(string) -> Ok(string)