[racket-dev] Typed units?
I currently have a function
array-fft : (Array Complex) -> (Array Float-Complex)
courtesy Robby and James. I'd also eventually like
bfarray-fft : (Array Bigfloat-Complex) -> (Array Bigfloat-Complex)
and others, corresponding to different kinds and precisions of numbers.
It would also be nice to allow the matrix operations to work on Bigfloat
and other kinds of numbers; currently, they're limited to Number. More
generally, it would be nice to make all the algorithms in the math
library generic.
One obvious approach is to use units, and provide the units and some
implementations that are already wired up. Is this fundamentally hard to
do in Typed Racket, easy but nobody had a reason yet, or somewhere in
between?
Generics is another option, but it seems they'd be harder to implement
in TR because dispatch is done at runtime.
Neil ⊥