2022-07-25 18:56:12 +00:00
|
|
|
export * from './Types/Complex.mjs'
|
|
|
|
export * from '../generic/Types/generic.mjs'
|
2022-07-19 16:52:16 +00:00
|
|
|
|
|
|
|
export const complex = {
|
2022-07-19 18:54:22 +00:00
|
|
|
/* Very permissive for sake of proof-of-concept; would be better to
|
|
|
|
* have a numeric/scalar type, e.g. by implementing subtypes in
|
|
|
|
* typed-function
|
|
|
|
*/
|
2022-07-25 18:56:12 +00:00
|
|
|
'undefined': () => u => u,
|
|
|
|
'undefined,any': () => (u, y) => u,
|
|
|
|
'any,undefined': () => (x, u) => u,
|
2022-08-05 12:48:57 +00:00
|
|
|
'undefined,undefined': () => (u, v) => u,
|
|
|
|
'T,T': () => (x, y) => ({re: x, im: y}),
|
2022-07-19 18:54:22 +00:00
|
|
|
/* Take advantage of conversions in typed-function */
|
2022-08-06 15:27:44 +00:00
|
|
|
// 'Complex<T>': () => z => z
|
|
|
|
/* But help out because without templates built in to typed-function,
|
|
|
|
* type inference turns out to be too hard
|
|
|
|
*/
|
|
|
|
'T': ({'zero(T)': zr}) => x => ({re: x, im: zr(x)})
|
2022-07-19 16:52:16 +00:00
|
|
|
}
|