Personal tools

Physical units/Dimensionalized numbers

From HaskellWiki

< Physical units(Difference between revisions)
Jump to: navigation, search
m (Dimensionalized numbers moved to Physical units/Dimensionalized numbers)
(remove link to Physical units, we have now sub-directory)
Line 16: Line 16:
   
 
See also the more polished http://www.scannedinavian.org/cgi-bin/darcs.cgi/hlibs/physics/?c=browse. It uses a different trick to get negative numbers -- instead of using positional numbers with negative digits, it uses pairs of PeanoNumbers to represent the difference between them, and normalizes to at least one of them being zero.
 
See also the more polished http://www.scannedinavian.org/cgi-bin/darcs.cgi/hlibs/physics/?c=browse. It uses a different trick to get negative numbers -- instead of using positional numbers with negative digits, it uses pairs of PeanoNumbers to represent the difference between them, and normalizes to at least one of them being zero.
 
==See also==
 
 
* [[Physical units]]
 
   
 
[[Category:Mathematics]]
 
[[Category:Mathematics]]

Revision as of 14:36, 30 September 2008

I have created a simple toy example using functional dependencies and phantom types to do compile-time unit analysis error catching at the type level. It currently has only two "base dimensions" time, and length, and very few convenience functions, but it is usable.

See the darcs repository available at

darcs get http://ofb.net/repos/dimensional/

or browseable at http://ofb.net/cgi-bin/darcs.cgi/dimensional/.

One annoying thing is that while the unitless type can be made an instance of Num, the others can't be made instances of things that support only (+) or (-). That should really be a seperate class, as in the Basic algebra proposal.

Comments appreciated, as are patches

-- Aaron Denney

See also the more polished http://www.scannedinavian.org/cgi-bin/darcs.cgi/hlibs/physics/?c=browse. It uses a different trick to get negative numbers -- instead of using positional numbers with negative digits, it uses pairs of PeanoNumbers to represent the difference between them, and normalizes to at least one of them being zero.