for this:
module Timer: {
type t
let setT: (unit => unit, int) => t
let clearT: t => unit
} = {
type t = int
// let setT = ....
let clearT = (inp: t) => Js.log(j`i got $inp`)
}
I can’t figure out how to write the setT function.
for this:
module Timer: {
type t
let setT: (unit => unit, int) => t
let clearT: t => unit
} = {
type t = int
// let setT = ....
let clearT = (inp: t) => Js.log(j`i got $inp`)
}
I can’t figure out how to write the setT function.
I’m not sure what to do with unit => unit
. This is an example for your reference:
let setT = (cb: unit => unit, inp: t) => {
cb()
inp
}
Open the playground to see it works
Thanks! that’s all I want!