Dimensional analysis with fundeps

Tom Pledger [email protected]
Tue, 10 Apr 2001 09:48:48 +1200


I like it!

 :
 | 3) Allow arbitrary user-defined "fundamental" dimensions
 |    (for things like dollars or radians) -- this may be
 |    very tricky;
 | 
 | 4) Allow several unit systems (such as SI and Imperial)
 |    to coexist.

Some suggestions/quibbles...

If you clearly make the type system deal with dimensions rather than
units, there's no problem with plugging in multiple unit systems.  You
just have to pick a scale for the representation.

    newtype Dimensioned mass length time rep = Dimensioned rep

    type Mass rep = Dimensioned One Zero Zero rep

    kg, lb :: Num a => Mass a
    kg = dm 1
    lb = dm 0.4535924

Angles are dimensionless.  (Think of the Taylor series for trig
functions.)

    radian, degree :: Unit
    radian = dm 1
    degree = dm (pi/180)

Regards,
Tom