The map function in rescript-json-combinators accepts only uncurried functions and the functions we are using are curried.
What is the best way to go around this? I don't know if there is a way to convert curried functions to unccuried functions or if I should create a new map function that accepts curried functions.
Some exapmles of a solution I have tried :
Before:
input'(
list{
type'("text"),
on(~key="", "input", Json.Decode.map(v => v |> int_of_string |> set_value, targetValue)),
},
list{},
),
After:
input'(
list{
type'("text"),
on(~key="", "input",((. v) => v |> int_of_string |> set_value)|> Json.Decode.map(targetValue)),
},
list{},
),`
Is this a correct way to solve this issue?
This solution wouldn't always work, couldn't figure out what to do in other cases.
Example:
let onMouseDown = onCB("mousedown", ~key= "", ev =>
decodeEvent(
map(Mouse.position, dragStart),
ev,
) |> Tea_result.resultToOption
)