Dimensional analysis with fundeps

Andrew Kennedy akenn@microsoft.com
Wed, 11 Apr 2001 08:39:48 -0700

You shouldn't need rational exponents to take square roots as long as no
*ground* type requires them. If polymorphism over units were primitive,
we'd have something like

  sqrt :: Real (u.u) -> Real u

for a fixed numeric type Real that's parameterized over its units. (BTW,
not possible to define such a function in the language using, say, only
arithmetic operators and comparison; you have to build it in instead).=20

In your encoding, is the following a valid type?

  sqrt :: (Num rep, Add kg kg kg', Add m m m', Add s s s') =3D>=20
    Dimensioned kg' m' s' rep -> Dimensioned kg m s rep

Or have I misunderstood multi-parameter classes with functional
- Andrew.

> -----Original Message-----
> From: anatoli [mailto:anatoli@yahoo.com]=20
> Sent: Monday, April 09, 2001 5:37 PM
> To: haskell@haskell.org
> Subject: Dimensional analysis with fundeps
> There is a couple of things :) left to make this usable:
> 2) Make it work with rational (not just integer) exponents,
>    so one can take square roots and the like.
>    (Can one do GCD in this style, without resorting to
>    undecidable and/or overlapping instances?);