Skip to content

Commit

Permalink
add map function
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Nov 29, 2024
1 parent 73759ba commit f339a17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/json/blueprint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ pub fn union_type_decoder(
)
}

pub fn map(decoder decoder: Decoder(a), over foo: fn(a) -> b) -> Decoder(b) {
let #(dyn_dec, schema) = decoder
#(fn(input) { result.map(dyn_dec(input), foo) }, schema)
}

pub fn tuple2(
first decode1: Decoder(a),
second decode2: Decoder(b),
Expand Down

0 comments on commit f339a17

Please sign in to comment.