ACM SIGPLAN Notices - Haskell '14
Many of the bugs in scientific programs have their roots in mis- treatment of physical dimensions, via erroneous expressions in the quantity calculus. Now that the type system in the Glasgow Haskell Compiler is rich enough to support type-level integers and other promoted datatypes, we can type-check the quantity calculus in Haskell. In addition to basic dimension-aware arithmetic and unit conversions, our units library features an extensible system of di- mensions and units, a notion of dimensions apart from that of units, and unit polymorphism designed to describe the laws of physics. We demonstrate the utility of units by writing an astrophysics re- search paper. This work is free of unit concerns because every quantity expression in the paper is rigorously type-checked.
© ACM, 2014. This is the author's version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution. The definitive version was published in ACM SIGPLAN Notices - Haskell '14, Volume 49, Issue 12, (December 2014) http://doi.acm.org/10.1145/2775050.2633362
Takayuki Muranushi and Richard A. Eisenberg, "Experience report: type-checking polymorphic units for astrophysics research in Haskell," ACM SIGPLAN Notices - Haskell '14 49.12 (2014): 31-38.