diff options
author | Giacomo Cavalieri <giacomo.cavalieri@icloud.com> | 2024-10-10 13:20:45 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-10-10 15:06:25 +0100 |
commit | 3b1af2de5e6d43ef69a7758a047a203eaa694784 (patch) | |
tree | f9320c5a48c166ba8552e8abe5b1934f2edf1b26 /src | |
parent | 3f60c0e9f5695d2797a6b28434cc14649dd62771 (diff) | |
download | gleam_stdlib-3b1af2de5e6d43ef69a7758a047a203eaa694784.tar.gz gleam_stdlib-3b1af2de5e6d43ef69a7758a047a203eaa694784.zip |
refactor dynamic
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/dynamic.gleam | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gleam/dynamic.gleam b/src/gleam/dynamic.gleam index 9073009..5b3bb46 100644 --- a/src/gleam/dynamic.gleam +++ b/src/gleam/dynamic.gleam @@ -85,9 +85,9 @@ pub fn string(from data: Dynamic) -> Result(String, DecodeErrors) { } fn map_errors( - result: Result(t, DecodeErrors), + result: Result(a, DecodeErrors), f: fn(DecodeError) -> DecodeError, -) -> Result(t, DecodeErrors) { +) -> Result(a, DecodeErrors) { result.map_error(result, list.map(_, f)) } @@ -467,7 +467,7 @@ fn decode_field(a: Dynamic, b: name) -> Result(Option(Dynamic), DecodeErrors) /// // ]) /// ``` /// -pub fn element(at index: Int, of inner_type: Decoder(t)) -> Decoder(t) { +pub fn element(at index: Int, of inner_type: Decoder(inner)) -> Decoder(inner) { fn(data: Dynamic) { use tuple <- result.try(decode_tuple(data)) let size = tuple_size(tuple) @@ -1018,7 +1018,7 @@ fn decode_map(a: Dynamic) -> Result(Dict(Dynamic, Dynamic), DecodeErrors) /// // -> Error(DecodeError(expected: "another type", found: "Int", path: [])) /// ``` /// -pub fn any(of decoders: List(Decoder(t))) -> Decoder(t) { +pub fn any(of decoders: List(Decoder(a))) -> Decoder(a) { fn(data) { case decoders { [] -> |