dimensional-1.3: Statically checked physical dimensions, using Type Families and Data Kinds.

CopyrightCopyright (C) 2006-2018 Bjorn Buckwalter
LicenseBSD3
Maintainerbjorn@buckwalter.se
StabilityStable
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010
ExtensionsDataKinds

Numeric.Units.Dimensional.Quantities

Contents

Description

Summary

This module defines type synonyms for common dimensionalities and the associated quantity types. Additional dimensionalities and quantity types will be added on an as-needed basis.

The definitions in this module are grouped so that a type synonym for the dimensionality is defined first in terms of base dimension exponents. Then a type synonym for the corresponding quantity type is defined. If there are several quantity types with the same dimensionality type synonyms are provided for each quantity type.

References

  1. http://physics.nist.gov/Pubs/SP811/
Synopsis

Quantities from the NIST Guide

The following quantities are all from the NIST publication "Guide for the Use of the International System of Units (SI)" [1]. Any chapters, sections or tables referenced are from [1] unless otherwise specified.

For lack of better organization we provide definitions grouped by table in [1].

Table 2

"Examples of SI derived units expressed in terms of SI base units."

Table 3

SI coherent derived units with special names and symbols.

Table 4

"Examples of SI coherent derived units expressed with the aid of SI derived units having special names and symbols."

We use the same grouping as for table 2.

Quantities not from the NIST Guide

Here we define additional quantities on an as-needed basis. We also provide some synonyms that we anticipate will be useful.

Powers of Unit Lengths

It is permissible to express powers of length units by prefixing square and cubic (see section 9.6 "Spelling unit names raised to powers" of [1]).

These definitions may seem slightly out of place but these is no obvious place where they should be. Here they are at least close to the definitions of DArea and DVolume.

square :: (Fractional a, Typeable m) => Unit m DLength a -> Unit NonMetric DArea a Source #

Constructs a unit of area from a unit of length, taking the area of a square whose sides are that length.

>>> 64 *~ square meter == (8 *~ meter) ^ pos2
True

cubic :: (Fractional a, Typeable m) => Unit m DLength a -> Unit NonMetric DVolume a Source #

Constructs a unit of volume from a unit of length, taking the volume of a cube whose sides are that length.

>>> 64 *~ cubic meter == (4 *~ meter) ^ pos3
True

Dimension Aliases

For each Quantity alias supplied above, we also supply a corresponding Dimension alias.

These dimension aliases may be convenient for supplying type signatures for Units or for other type-level dimensional programming.