Re: Units of measure

1999-08-30 Thread Anatoli Tubman
On Aug 26, 18:34, Christian Sievers wrote: Is there any sense physically in rational exponents? It depends on unit system. SI wants electric charge to be fundamental (and Coulomb's constant is derived from it), while CGS assumes Coulomb's constant = 1 and charge is derived: Charge ^ 2

Re: Units of measure

1999-08-26 Thread Andreas Rossberg
Tom Pledger wrote: Where do units of measure fit into a type system? In Haskell this should be quite easy. Off my head I would suggest something like class Unit a where unit :: Float - a value :: a - Float newtype Metres = Metres Float

Re: Units of measure

1999-08-26 Thread Anatoli Tubman
I once wrote a C++ template library that did exactly that. Arbitrary units, rational exponents -- you can have (m^(3/2)/kg^(5/16)) dimensioned value. All at compile time, without runtime checking whatsoever. Too bad it took eternity to compile a simplest program. Things like that should be

Re: Units of measure

1999-08-26 Thread Herbert Graeber
Good idea. Andrew Kennedy wrote a whole thesis about this, and a paper or two besides. http://research.microsoft.com/~akenn/ Unfortunalty this work concentrates on extending a programming language with units. It would be better to extend Haskell with more universal features that makes the

Re: Units of measure

1999-08-26 Thread Andreas Rossberg
"D. Tweed" wrote: Isn't the issue a bit weirder than this in that you've also got pure numbers which ought be usable with the same operators (*$,etc) You are right, I overlooked that. But this is not even the most serious problem, overloading the operators accordingly might be possible with

Re: Units of measure

1999-08-26 Thread Anatoli Tubman
Not sure it will work... how do you handle Quot (Prod Metres Metres) (Prod Seconds Metres) or make sure that Prod Metres Seconds is the same as Prod Seconds Metres ??? On Aug 26, 10:36, Andreas Rossberg wrote: Subject: Re: Units of measure Tom Pledger wrote

Re: Units of measure

1999-08-26 Thread Lennart Augustsson
Christian Sievers wrote: Anatoli Tubman wrote: I once wrote a C++ template library that did exactly that. Arbitrary units, rational exponents -- you can have (m^(3/2)/kg^(5/16)) dimensioned value. All at compile time, without runtime checking whatsoever. Is there any sense physically

Re: Units of measure

1999-08-26 Thread Christian Sievers
Anatoli Tubman wrote: I once wrote a C++ template library that did exactly that. Arbitrary units, rational exponents -- you can have (m^(3/2)/kg^(5/16)) dimensioned value. All at compile time, without runtime checking whatsoever. Is there any sense physically in rational exponents? If not,

RE: Units of measure

1999-08-26 Thread Simon Peyton-Jones
Good idea. Andrew Kennedy wrote a whole thesis about this, and a paper or two besides. http://research.microsoft.com/~akenn/ -Original Message- From: Tom Pledger Sent: Thursday, August 26, 1999 7:56 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Units of measure

Re: Units of measure

1999-08-26 Thread Christian Sievers
(Cayenne doesn't happen to have c*n-patterns?) [ ;-) forgotten.] `c*n' and `n+k' are equally abominable. Cayenne has neither. I thought they might be nice to express the type of sqrt. When we have the type as Unit (mass::Int) (length::Int) (time::Int) = Double it should be s.th. like

Re: Units of measure

1999-08-26 Thread Jonathan King
On Thu, 26 Aug 1999, Christian Sievers wrote: Anatoli Tubman wrote: I once wrote a C++ template library that did exactly that. Arbitrary units, rational exponents -- you can have (m^(3/2)/kg^(5/16)) dimensioned value. All at compile time, without runtime checking whatsoever.