dimensional-1.5: Statically checked physical dimensions

Copyright | Copyright (C) 2006-2018 Bjorn Buckwalter
License | BSD3
Maintainer | bjorn@buckwalter.se
Stability | Stable
Portability | GHC only
Safe Haskell | Safe-Inferred
Language | Haskell2010

Numeric.Units.Dimensional.SIUnits

Contents

- SI Base Units
- SI Derived Units
  - Celsius Temperature
  - Units Admitted for Reasons of Safeguarding Human Health
- Units Accepted for Use with the SI
  - Units of Plane Angle
  - Units Formerly Defined By Experiment
- SI Prefixes

Description

# Summary

This module defines the SI prefixes, the SI base units and the SI derived units. It also defines the units outside of the SI that are accepted for use with the SI. Any chapters, sections or tables referenced are from [1] unless otherwise specified.

# References

1. https://www.nist.gov/pml/special-publication-811
2. https://en.wikipedia.org/wiki/Minute_of_arc
3. https://en.wikipedia.org/wiki/Astronomical_unit

Synopsis

- metre :: Num a => Unit 'Metric DLength a
- meter :: Num a => Unit 'Metric DLength a
- gram :: Fractional a => Unit 'Metric DMass a
- second :: Num a => Unit 'Metric DTime a
- ampere :: Num a => Unit 'Metric DElectricCurrent a
- kelvin :: Num a => Unit 'Metric DThermodynamicTemperature a
- mole :: Num a => Unit 'Metric DAmountOfSubstance a
- candela :: Num a => Unit 'Metric DLuminousIntensity a
- radian :: Num a => Unit 'Metric DPlaneAngle a
- steradian :: Num a => Unit 'Metric DSolidAngle a
- hertz :: Num a => Unit 'Metric DFrequency a
- newton :: Num a => Unit 'Metric DForce a
- pascal :: Num a => Unit 'Metric DPressure a
- joule :: Num a => Unit 'Metric DEnergy a
- watt :: Num a => Unit 'Metric DPower a
- coulomb :: Num a => Unit 'Metric DElectricCharge a
- volt :: Num a => Unit 'Metric DElectricPotential a
- farad :: Num a => Unit 'Metric DCapacitance a
- ohm :: Num a => Unit 'Metric DElectricResistance a
- siemens :: Num a => Unit 'Metric DElectricConductance a
- weber :: Num a => Unit 'Metric DMagneticFlux a
- tesla :: Num a => Unit 'Metric DMagneticFluxDensity a
- henry :: Num a => Unit 'Metric DInductance a
- lumen :: Num a => Unit 'Metric DLuminousFlux a
- lux :: Num a => Unit 'Metric DIlluminance a
- degreeCelsius :: Num a => Unit 'Metric DCelsiusTemperature a
- fromDegreeCelsiusAbsolute :: Floating a => a -> ThermodynamicTemperature a
- toDegreeCelsiusAbsolute :: Floating a => ThermodynamicTemperature a -> a
- becquerel :: Num a => Unit 'Metric DActivity a
- gray :: Num a => Unit 'Metric DAbsorbedDose a
- sievert :: Num a => Unit 'Metric DDoseEquivalent a
- katal :: Num a => Unit 'Metric DCatalyticActivity a
- minute :: Num a => Unit 'NonMetric DTime a
- hour :: Num a => Unit 'NonMetric DTime a
- day :: Num a => Unit 'NonMetric DTime a
- hectare :: Fractional a => Unit 'NonMetric DArea a
- litre :: Fractional a => Unit 'Metric DVolume a
- liter :: Fractional a => Unit 'Metric DVolume a
- tonne :: Num a => Unit 'Metric DMass a
- metricTon :: Num a => Unit 'Metric DMass a
- degree :: Floating a => Unit 'NonMetric DPlaneAngle a
- arcminute :: Floating a => Unit 'NonMetric DPlaneAngle a
- arcsecond :: Floating a => Unit 'NonMetric DPlaneAngle a
- degreeOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
- minuteOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
- secondOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
- astronomicalUnit :: Num a => Unit 'NonMetric DLength a
- deka :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- deca :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- hecto :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- kilo :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- mega :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- giga :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- tera :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- peta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- exa :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- zetta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- yotta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
- deci :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- centi :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- milli :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- micro :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- nano :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- pico :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- femto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- atto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- zepto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- yocto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
- data Prefix
- applyPrefix :: Fractional a => Prefix -> Unit 'Metric d a -> Unit 'NonMetric d a
- siPrefixes :: [Prefix]

# SI Base Units

These are the base units from section 4.1. To avoid a myriad of one-letter functions that would doubtlessly cause clashes and frustration in users' code, we spell out all unit names in full, as we did for prefixes. We also elect to spell the unit names in singular form, as allowed by section 9.7 "Other spelling conventions".

We define the SI base units in the order of table 1.

metre :: Num a => Unit 'Metric DLength a Source #

meter :: Num a => Unit 'Metric DLength a Source #

gram :: Fractional a => Unit 'Metric DMass a Source #

second :: Num a => Unit 'Metric DTime a Source #

ampere :: Num a => Unit 'Metric DElectricCurrent a Source #

kelvin :: Num a => Unit 'Metric DThermodynamicTemperature a Source #

mole :: Num a => Unit 'Metric DAmountOfSubstance a Source #

candela :: Num a => Unit 'Metric DLuminousIntensity a Source #

# SI Derived Units

From Table 3, SI derived units with special names and symbols, including the radian and steradian.

radian :: Num a => Unit 'Metric DPlaneAngle a Source #

steradian :: Num a => Unit 'Metric DSolidAngle a Source #

hertz :: Num a => Unit 'Metric DFrequency a Source #

newton :: Num a => Unit 'Metric DForce a Source #

pascal :: Num a => Unit 'Metric DPressure a Source #

joule :: Num a => Unit 'Metric DEnergy a Source #

watt :: Num a => Unit 'Metric DPower a Source #

coulomb :: Num a => Unit 'Metric DElectricCharge a Source #

volt :: Num a => Unit 'Metric DElectricPotential a Source #

farad :: Num a => Unit 'Metric DCapacitance a Source #

ohm :: Num a => Unit 'Metric DElectricResistance a Source #

siemens :: Num a => Unit 'Metric DElectricConductance a Source #

weber :: Num a => Unit 'Metric DMagneticFlux a Source #

tesla :: Num a => Unit 'Metric DMagneticFluxDensity a Source #

henry :: Num a => Unit 'Metric DInductance a Source #

lumen :: Num a => Unit 'Metric DLuminousFlux a Source #

lux :: Num a => Unit 'Metric DIlluminance a Source #

## Celsius Temperature

A problematic area is units which increase proportionally to the base SI units but cross zero at a different point. An example would be degrees Celsius (see section 4.2.1.1). The author feels that it is appropriate to define a unit for use with relative quantities (taking only into account the proportionality) and complement the unit with functions for converting absolute values.

The function `fromDegreeCelsiusAbsolute` should be used in lieu of "*~ degreeCelsius" when working with absolute temperatures. Similarily, `toDegreeCelsiusAbsolute` should be used in lieu of "/~ degreeCelsius" when working with absolute temperatures.

degreeCelsius :: Num a => Unit 'Metric DCelsiusTemperature a Source #

fromDegreeCelsiusAbsolute :: Floating a => a -> ThermodynamicTemperature a Source #

toDegreeCelsiusAbsolute :: Floating a => ThermodynamicTemperature a -> a Source #

## Units Admitted for Reasons of Safeguarding Human Health

The last units from Table 3 are SI derived units with special names and symbols admitted for reasons of safeguarding human health.

becquerel :: Num a => Unit 'Metric DActivity a Source #

gray :: Num a => Unit 'Metric DAbsorbedDose a Source #

sievert :: Num a => Unit 'Metric DDoseEquivalent a Source #

katal :: Num a => Unit 'Metric DCatalyticActivity a Source #

# Units Accepted for Use with the SI

There are several units that are not strictly part of the SI but are either permanently or temporarily accepted for use with the SI. We define the permanently accepted ones in this module.

From Table 6, Units accepted for use with the SI.

We start with time which we grant exclusive rights to `minute` and `second`.

minute :: Num a => Unit 'NonMetric DTime a Source #

hour :: Num a => Unit 'NonMetric DTime a Source #

day :: Num a => Unit 'NonMetric DTime a Source #

hectare :: Fractional a => Unit 'NonMetric DArea a Source #

litre :: Fractional a => Unit 'Metric DVolume a Source #

liter :: Fractional a => Unit 'Metric DVolume a Source #

tonne :: Num a => Unit 'Metric DMass a Source #

metricTon :: Num a => Unit 'Metric DMass a Source #

## Units of Plane Angle

Since `minute` and `second` are already in use for time we use `arcminute` and `arcsecond` [2] for plane angle instead.

degree :: Floating a => Unit 'NonMetric DPlaneAngle a Source #

arcminute :: Floating a => Unit 'NonMetric DPlaneAngle a Source #

arcsecond :: Floating a => Unit 'NonMetric DPlaneAngle a Source #

Alternate (longer) forms of the above. In particular `degreeOfArc` can be used if there is a percieved need to disambiguate from e.g. temperature.

degreeOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a Source #

minuteOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a Source #

secondOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a Source #

## Units Formerly Defined By Experiment

We decline to provide here those units - listed in Table 7 - which, while accepted for use with the SI, have values which are determined experimentally. For versioning purposes, those units can be found in Numeric.Units.Dimensional.NonSI.

However, in 2012 the IAU redefined the astronomical unit as a conventional unit of length directly tied to the meter, with a length of exactly 149 597 870 700 m and the official abbreviation of au [3]. We therefore include it here.

astronomicalUnit :: Num a => Unit 'NonMetric DLength a Source #

# SI Prefixes

Prefixes are used to form decimal multiples and submultiples of SI Units as described in section 4.4.

By defining SI prefixes as functions applied to a `Unit` we satisfy section 6.2.6 "Unacceptability of stand-alone prefixes".

We define all SI prefixes from Table 5. Multiples first.

deka :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

An alias for `deca`.

deca :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "deca" prefix, denoting a factor of 10.

hecto :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "hecto" prefix, denoting a factor of 100.

kilo :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "kilo" prefix, denoting a factor of 1000.

mega :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "mega" prefix, denoting a factor of 10^6.

giga :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "giga" prefix, denoting a factor of 10^9.

tera :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "tera" prefix, denoting a factor of 10^12.

peta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "peta" prefix, denoting a factor of 10^15.

exa :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "exa" prefix, denoting a factor of 10^18.

zetta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "zetta" prefix, denoting a factor of 10^21.

yotta :: Num a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "yotta" prefix, denoting a factor of 10^24.

Then the submultiples.

deci :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "deci" prefix, denoting a factor of 0.1.

centi :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "centi" prefix, denoting a factor of 0.01.

milli :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "milli" prefix, denoting a factor of 0.001.

micro :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "micro" prefix, denoting a factor of 10^-6.

nano :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "nano" prefix, denoting a factor of 10^-9.

pico :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "pico" prefix, denoting a factor of 10^-12.

femto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "femto" prefix, denoting a factor of 10^-15.

atto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "atto" prefix, denoting a factor of 10^-18.

zepto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "zepto" prefix, denoting a factor of 10^-21.

yocto :: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a Source #

The "yocto" prefix, denoting a factor of 10^-24.

We supply an explicit representation of an SI prefix, along with a function to apply one and a list of all prefixes defined by the SI.

data Prefix Source #

A metric prefix.

#### Instances

Instances details

Data Prefix Source # |

Instance details

Defined in Numeric.Units.Dimensional.UnitNames.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prefix -> c Prefix Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prefix Source #

toConstr :: Prefix -> Constr Source #

dataTypeOf :: Prefix -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Prefix) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prefix) Source #

gmapT :: (forall b. Data b => b -> b) -> Prefix -> Prefix Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Prefix -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Prefix -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Prefix -> m Prefix Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Prefix -> m Prefix Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Prefix -> m Prefix Source #

Generic Prefix Source # |
Instance details Defined in Numeric.Units.Dimensional.UnitNames.Internal Associated Types type Rep Prefix :: Type -> Type Source # Methods from :: Prefix -> Rep Prefix x Source # to :: Rep Prefix x -> Prefix Source #
NFData Prefix Source # |
Instance details Defined in Numeric.Units.Dimensional.UnitNames.Internal Methods rnf :: Prefix -> () Source #
HasInterchangeName Prefix Source # |
Instance details Defined in Numeric.Units.Dimensional.UnitNames.Internal Methods interchangeName :: Prefix -> InterchangeName Source #
Eq Prefix Source # |
Instance details Defined in Numeric.Units.Dimensional.UnitNames.Internal Methods (==) :: Prefix -> Prefix -> Bool Source # (/=) :: Prefix -> Prefix -> Bool Source #
Ord Prefix Source # |
Instance details Defined in Numeric.Units.Dimensional.UnitNames.Internal Methods compare :: Prefix -> Prefix -> Ordering Source # (<) :: Prefix -> Prefix -> Bool Source # (<=) :: Prefix -> Prefix -> Bool Source # (>) :: Prefix -> Prefix -> Bool Source # (>=) :: Prefix -> Prefix -> Bool Source # max :: Prefix -> Prefix -> Prefix Source # min :: Prefix -> Prefix -> Prefix Source #
type Rep Prefix Source # |

Instance details

Defined in Numeric.Units.Dimensional.UnitNames.Internal

type Rep Prefix = D1 ('MetaData "Prefix" "Numeric.Units.Dimensional.UnitNames.Internal" "dimensional-1.5-JocKE6CJzn4394JHdrLVJ" 'False) (C1 ('MetaCons "Prefix" 'PrefixI 'True) (S1 ('MetaSel ('Just "prefixName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PrefixName) :*: S1 ('MetaSel ('Just "scaleFactor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational)))

applyPrefix :: Fractional a => Prefix -> Unit 'Metric d a -> Unit 'NonMetric d a Source #

Apply a `Prefix` to a metric `Unit`.

siPrefixes :: [Prefix] Source #

A list of all `Prefix`es defined by the SI.