diff options
author | Louis Pilfold <louis@lpil.uk> | 2020-05-19 21:08:13 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-05-26 19:19:29 +0100 |
commit | 95a7471db17604a774518930ab7843b1e0f3a0ac (patch) | |
tree | 4326140cb1fde1eb39a88cc5623018d7eb8443d7 /src | |
parent | e310ad8c59eb3be0c31443649f0a96fd0306a443 (diff) | |
download | gleam_stdlib-95a7471db17604a774518930ab7843b1e0f3a0ac.tar.gz gleam_stdlib-95a7471db17604a774518930ab7843b1e0f3a0ac.zip |
Try!
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/dynamic.gleam | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/gleam/dynamic.gleam b/src/gleam/dynamic.gleam index 3778a47..6b54df1 100644 --- a/src/gleam/dynamic.gleam +++ b/src/gleam/dynamic.gleam @@ -231,22 +231,10 @@ pub fn tuple2_of( first decode_first: Decoder(a), second decode_second: Decoder(b), ) -> Result(tuple(a, b), String) { - tup - |> tuple2 - |> result.then( - fn(tup) { - let tuple(first, second) = tup - decode_first(first) - |> result.map(fn(first) { tuple(first, second) }) - }, - ) - |> result.then( - fn(tup) { - let tuple(first, second) = tup - decode_second(second) - |> result.map(fn(second) { tuple(first, second) }) - }, - ) + try tuple(first, second) = tuple2(tup) + try a = decode_first(first) + try b = decode_second(second) + Ok(tuple(a, b)) } /// Check to see if the Dynamic value is map. |