module Numeric.Units.Dimensional.SIUnits
(
metre, meter, gram, second, ampere, kelvin, mole, candela,
radian, steradian, hertz, newton, pascal, joule, watt, coulomb, volt, farad, ohm, siemens, weber, tesla, henry, lumen, lux,
degreeCelsius, fromDegreeCelsiusAbsolute, toDegreeCelsiusAbsolute,
becquerel, gray, sievert, katal,
minute, hour, day,
hectare, litre, liter, tonne, metricTon,
degree, arcminute, arcsecond,
degreeOfArc, minuteOfArc, secondOfArc,
astronomicalUnit,
deka, deca, hecto, kilo, mega, giga, tera, peta, exa, zetta, yotta,
deci, centi, milli, micro, nano, pico, femto, atto, zepto, yocto
)
where
import Numeric.Units.Dimensional
import Numeric.Units.Dimensional.Quantities
import Numeric.Units.Dimensional.UnitNames (PrefixName, applyPrefix, nMeter, nGram, nSecond, nAmpere, nKelvin, nMole, nCandela)
import qualified Numeric.Units.Dimensional.UnitNames as N
import Numeric.Units.Dimensional.UnitNames.Internal (ucum, ucumMetric)
import Numeric.NumType.DK.Integers ( pos3 )
import Prelude ( ($), Num, Fractional, Floating, Integer, Rational, recip)
import qualified Prelude
applyMultiple :: (Num a) => PrefixName -> Integer -> Unit 'Metric d a -> Unit 'NonMetric d a
applyMultiple p x u = mkUnitZ (applyPrefix p (name u)) x u
deka, deca, hecto, kilo, mega, giga, tera, peta, exa, zetta, yotta
:: Num a => Unit 'Metric d a -> Unit 'NonMetric d a
deka = applyMultiple N.deka 10
deca = deka
hecto = applyMultiple N.hecto 100
kilo = applyMultiple N.kilo 1e3
mega = applyMultiple N.mega 1e6
giga = applyMultiple N.giga 1e9
tera = applyMultiple N.tera 1e12
peta = applyMultiple N.peta 1e15
exa = applyMultiple N.exa 1e18
zetta = applyMultiple N.zetta 1e21
yotta = applyMultiple N.yotta 1e24
applySubmultiple :: (Fractional a) => PrefixName -> Rational -> Unit 'Metric d a -> Unit 'NonMetric d a
applySubmultiple p x u = mkUnitQ (applyPrefix p (name u)) x u
deci, centi, milli, micro, nano, pico, femto, atto, zepto, yocto
:: Fractional a => Unit 'Metric d a -> Unit 'NonMetric d a
deci = applySubmultiple N.deci 0.1
centi = applySubmultiple N.centi 0.01
milli = applySubmultiple N.milli 1e-3
micro = applySubmultiple N.micro 1e-6
nano = applySubmultiple N.nano 1e-9
pico = applySubmultiple N.pico 1e-12
femto = applySubmultiple N.femto 1e-15
atto = applySubmultiple N.atto 1e-18
zepto = applySubmultiple N.zepto 1e-21
yocto = applySubmultiple N.yocto 1e-24
metre, meter :: Num a => Unit 'Metric DLength a
metre = mkUnitZ nMeter 1 siUnit
meter = metre
gram :: Fractional a => Unit 'Metric DMass a
gram = mkUnitQ nGram 1e-3 siUnit
second :: Num a => Unit 'Metric DTime a
second = mkUnitZ nSecond 1 siUnit
ampere :: Num a => Unit 'Metric DElectricCurrent a
ampere = mkUnitZ nAmpere 1 siUnit
kelvin :: Num a => Unit 'Metric DThermodynamicTemperature a
kelvin = mkUnitZ nKelvin 1 siUnit
mole :: Num a => Unit 'Metric DAmountOfSubstance a
mole = mkUnitZ nMole 1 siUnit
candela :: Num a => Unit 'Metric DLuminousIntensity a
candela = mkUnitZ nCandela 1 siUnit
radian :: Num a => Unit 'Metric DPlaneAngle a
radian = mkUnitZ (ucumMetric "rad" "rad" "radian") 1 siUnit
steradian :: Num a => Unit 'Metric DSolidAngle a
steradian = mkUnitZ (ucumMetric "sr" "sr" "steradian") 1 siUnit
hertz :: Num a => Unit 'Metric DFrequency a
hertz = mkUnitZ (ucumMetric "Hz" "Hz" "Hertz") 1 $ siUnit
newton :: Num a => Unit 'Metric DForce a
newton = mkUnitZ (ucumMetric "N" "N" "Newton") 1 $ siUnit
pascal :: Num a => Unit 'Metric DPressure a
pascal = mkUnitZ (ucumMetric "Pa" "Pa" "Pascal") 1 $ siUnit
joule :: Num a => Unit 'Metric DEnergy a
joule = mkUnitZ (ucumMetric "J" "J" "Joule") 1 $ siUnit
watt :: Num a => Unit 'Metric DPower a
watt = mkUnitZ (ucumMetric "W" "W" "Watt") 1 $ siUnit
coulomb :: Num a => Unit 'Metric DElectricCharge a
coulomb = mkUnitZ (ucumMetric "C" "C" "Coulomb") 1 $ siUnit
volt :: Num a => Unit 'Metric DElectricPotential a
volt = mkUnitZ (ucumMetric "V" "V" "Volt") 1 $ siUnit
farad :: Num a => Unit 'Metric DCapacitance a
farad = mkUnitZ (ucumMetric "F" "F" "Farad") 1 $ siUnit
ohm :: Num a => Unit 'Metric DElectricResistance a
ohm = mkUnitZ (ucumMetric "Ohm" "Ω" "Ohm") 1 $ siUnit
siemens :: Num a => Unit 'Metric DElectricConductance a
siemens = mkUnitZ (ucumMetric "S" "S" "Siemens") 1 $ siUnit
weber :: Num a => Unit 'Metric DMagneticFlux a
weber = mkUnitZ (ucumMetric "Wb" "Wb" "Weber") 1 $ siUnit
tesla :: Num a => Unit 'Metric DMagneticFluxDensity a
tesla = mkUnitZ (ucumMetric "T" "T" "Tesla") 1 $ siUnit
henry :: Num a => Unit 'Metric DInductance a
henry = mkUnitZ (ucumMetric "H" "H" "Henry") 1 $ siUnit
lumen :: Num a => Unit 'Metric DLuminousFlux a
lumen = mkUnitZ (ucumMetric "lm" "lm" "lumen") 1 $ siUnit
lux :: Num a => Unit 'Metric DIlluminance a
lux = mkUnitZ (ucumMetric "lx" "lx" "lux") 1 $ siUnit
degreeCelsius :: Num a => Unit 'Metric DCelsiusTemperature a
degreeCelsius = kelvin
fromDegreeCelsiusAbsolute :: Floating a => a -> ThermodynamicTemperature a
fromDegreeCelsiusAbsolute x = x *~ degreeCelsius + 273.15 *~ degreeCelsius
toDegreeCelsiusAbsolute :: Floating a => ThermodynamicTemperature a -> a
toDegreeCelsiusAbsolute x = (x 273.15 *~ degreeCelsius) /~ degreeCelsius
becquerel :: Num a => Unit 'Metric DActivity a
becquerel = mkUnitZ (ucumMetric "Bq" "Bq" "Becquerel") 1 $ siUnit
gray :: Num a => Unit 'Metric DAbsorbedDose a
gray = mkUnitZ (ucumMetric "Gy" "Gy" "Gray") 1 $ siUnit
sievert :: Num a => Unit 'Metric DDoseEquivalent a
sievert = mkUnitZ (ucumMetric "Sv" "Sv" "Sievert") 1 $ siUnit
katal :: Num a => Unit 'Metric DCatalyticActivity a
katal = mkUnitZ (ucumMetric "kat" "kat" "katal") 1 $ siUnit
minute, hour, day :: Num a => Unit 'NonMetric DTime a
minute = mkUnitZ (ucum "min" "min" "minute") 60 $ second
hour = mkUnitZ (ucum "h" "h" "hour") 60 $ minute
day = mkUnitZ (ucum "d" "d" "day") 24 $ hour
degree, arcminute, arcsecond :: Floating a => Unit 'NonMetric DPlaneAngle a
degree = mkUnitR (ucum "deg" "°" "degree") (Prelude.pi Prelude./ 180) $ radian
arcminute = mkUnitR (ucum "'" "'" "arcminute") (recip 60) $ degreeOfArc
arcsecond = mkUnitR (ucum "''" "''" "arcsecond") (recip 60) $ minuteOfArc
degreeOfArc, minuteOfArc, secondOfArc :: Floating a => Unit 'NonMetric DPlaneAngle a
degreeOfArc = degree
secondOfArc = arcsecond
minuteOfArc = arcminute
hectare :: Fractional a => Unit 'NonMetric DArea a
hectare = square (hecto meter)
litre, liter :: Fractional a => Unit 'Metric DVolume a
litre = mkUnitQ (ucumMetric "L" "L" "litre") 1 $ deci meter ^ pos3
liter = litre
tonne, metricTon :: Num a => Unit 'Metric DMass a
tonne = mkUnitZ (ucumMetric "t" "t" "tonne") 1000 $ siUnit
metricTon = tonne
astronomicalUnit :: Num a => Unit 'NonMetric DLength a
astronomicalUnit = mkUnitZ (ucum "AU" "AU" "astronomical unit") 149597870700 $ meter