feat: add more type functions (FAIL: type recursion)
This commit is contained in:
parent
40d05045fc
commit
fafc747be5
@ -20,5 +20,13 @@ export const Complex_type = {
|
|||||||
export const typeImps = <T>() => ({
|
export const typeImps = <T>() => ({
|
||||||
complex_unary: (dep: Dependency<'zero', [T]>) =>
|
complex_unary: (dep: Dependency<'zero', [T]>) =>
|
||||||
(t: T) => ({re: t, im: dep.zero(t)}),
|
(t: T) => ({re: t, im: dep.zero(t)}),
|
||||||
complex_binary: (t: T, u: T) => ({re: t, im: u})
|
complex_binary: (t: T, u: T) => ({re: t, im: u}),
|
||||||
|
zero: (dep: Dependency<'zero', [T]>) =>
|
||||||
|
(z: Complex<T>) => ({re: dep.zero(z.re), im: dep.zero(z.im)}),
|
||||||
|
one: (dep: Dependency<'zero' | 'one', [T]>) =>
|
||||||
|
(z: Complex<T>) => ({re: dep.one(z.re), re: dep.zero(z.im)}),
|
||||||
|
nan: (dep: Dependency<'nan', [T]>) =>
|
||||||
|
(z: Complex<T>) => ({re: dep.nan(z.re), im: dep.nan(z.im)}),
|
||||||
|
re: (dep: Dependency<'re', [T]>) =>
|
||||||
|
(z: Complex<T>) => dep.re(z.re)
|
||||||
})
|
})
|
||||||
|
@ -5,5 +5,8 @@ export const number_type = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const typeImps = <T>() => ({
|
export const typeImps = <T>() => ({
|
||||||
zero: (a: number) => 0
|
zero: (a: number) => 0,
|
||||||
|
one: (a: number) => 1,
|
||||||
|
nan: (a: number) => NaN,
|
||||||
|
re: (a: number) => a
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user