You shouldn't need rational exponents to take square roots as long as no
*ground* type requires them. If polymorphism over units were primitive,
then
we'd have something like
sqrt :: Real (u.u) -> Real u
for a fixed numeric type Real that's parameterized over its units. (BTW,
it's
not possible to define such a function in the language using, say, only
standard
arithmetic operators and comparison; you have to build it in instead).
In your encoding, is the following a valid type?
sqrt :: (Num rep, Add kg kg kg', Add m m m', Add s s s') =>
Dimensioned kg' m' s' rep -> Dimensioned kg m s rep
Or have I misunderstood multi-parameter classes with functional
dependencies?
- Andrew.
> -----Original Message-----
> From: anatoli [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 09, 2001 5:37 PM
> To: [EMAIL PROTECTED]
> 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?);
>
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell