I'm cross-posting this to the Libraries list...

At 2001-04-10 18:02, Fergus Henderson wrote:

>Still, the need to insert explicit `toUnits' is
>annoying, and it would be nice to have a system where every number was
>already a dimensionless unit.

That's easy:

--
type Unit rep       = Dimensioned Zero Zero Zero rep;

instance (Real a) => Real (Unit a) where
     {
     -- put instances here
     };
--

Of course you'll have to appropriately declare superclasses of Real, such 
as Num, Ord, Show, Eq etc.

-- 
Ashley Yakeley, Seattle WA


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to