Dimensional analysis with fundeps
Dylan Thurston
dpt@math.harvard.edu
Mon, 9 Apr 2001 13:29:02 -0400
On Mon, Apr 09, 2001 at 09:36:45AM -0700, anatoli wrote:
> It seems that fundeps are powerful enough to do
> compile-time dimensional analysis in Haskell. That
> is, one can devise types that represent dimensions of
> quantities, such as (meter / second) or
> (kilogram * meter / second^2),
> and have a complete set of type-correct operations on
> such types.
Yes. Note that specific language support for dimensions can do more;
e.g., with a style like Andrew Kennedy's, you get much nicer principal
types.
I hadn't thought about doing rational arithmetic with GCDs. Might be
nice.
One point of view is that if you can do things like this painfully and
explicitly in the current type system, Haskell might as well provide
support to do it explicitly.
Best,
Dylan Thurston