Dimensional is a library providing data types for performing arithmetic with physical quantities and units. Information about the physical dimensions of the quantities/units is embedded in their types and the validity of operations is verified by the type checker at compile time. The boxing and unboxing of numerical values as quantities is done by multiplication and division with units. The library is designed to, as far as is practical, enforce/encourage best practices of unit usage.
A spin-off of dimensional is the numtype library which provides a type-level representation of integers. Numtype is a dependency of the dimensional library.
For documentation: see Conclusion and usage in the original announcement, the literate haskell code or the examples in the wiki.
The latest release can be installed with cabal install dimensional
or
downloaded from Hackage.
This implementation of dimensional, built on multiparameter type classes and functional dependencies, is the canonical version.
In addition to the standard dimensional built on Functional Dependencies
there is an experimental implementation of dimensional built on (open)
Type Families. Install with cabal install dimensional-tf
.
dimensional-dk (the future)
A new implementation leveraging Data Kinds and Closed Type Families is being drafted on Github. We believe this will be the new preferred implementation once it is completed.