typocomath/src/experiment/arithmeticInfer.ts

9 lines
235 B
TypeScript
Raw Normal View History

import { $reflect } from '../core/$reflect.js'
2023-09-01 15:52:44 +00:00
export const square = $reflect('__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)
)