typocomath/src/experiment/arithmeticInfer.ts

9 lines
236 B
TypeScript
Raw Normal View History

2023-09-01 16:36:50 +00:00
import { typed } from '../core/typed.js'
2023-09-01 15:52:44 +00:00
export const square = typed('square', '__infer__', <T>(dep: {
2023-09-01 15:52:44 +00:00
multiply: (a: T, b: T) => T,
unaryMinus: (x: T) => T, // just for the experiment
}): (a: T) => T =>
z => dep.multiply(z, z)
)