[Haskell-cafe] Instantiation problem

Henning Thielemann schlepptop at henning-thielemann.de
Sat Jan 29 21:56:29 CET 2011


Patrick Browne schrieb:
> Below is some code that is produces information about the *types* used
> for measuring (e.g. metres).  The following evaluation returns 1.00
> which the convert factor for metres.
> 
> convertFactorToBaseUnit (unit (LengthInMetres  7))
> .
> The next evaluation returns the type, Metre, of data being measured
> unit (LengthInMetres  7)

Is there a reason why you use an individual type for every unit?
The existing implementations of typed physical units only encode the
physical dimension in types and leave the unit factors to the value
level. I found this to be the most natural way.

http://www.haskell.org/haskellwiki/Physical_units




More information about the Haskell-Cafe mailing list