Mathematical/physical/chemical constants

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed and maintained by Anton Vorontsov

Science.Constants.Dimensional is a variant of Science.Constants[1] package, with the only difference is that that the dimensional flavor provides (where applicable) dimensionally-typed constants. The Numeric.Units.Dimensional[2] wrappers allow to write type-safe formulas, for example all of this will successfully type-check:

~$ ghci -XNoImplicitPrelude
λ= import Numeric.Units.Dimensional.Prelude

λ= import Science.Constants.Dimensional

λ= massOfProton + massOfElectron

1.673532715291e-27 kg
λ= massOfProton / massOfElectron


But this will not:

λ= massOfProton / massOfElectron + planckConstant

    Couldn't match type `Numeric.NumType.Pos
                           (Numeric.NumType.Pos Numeric.NumType.Zero)'
                  with `Numeric.NumType.Zero'
comments powered byDisqus