typocomath/src/experiment/arithmeticInfer.ts

9 lines
222 B
TypeScript

import { $reflect } from '../core/$reflect.js'
export const square = $reflect(<T>(dep: {
multiply: (a: T, b: T) => T,
unaryMinus: (x: T) => T, // just for the experiment
}): (a: T) => T =>
z => dep.multiply(z, z)
)