{-# LANGUAGE RebindableSyntax #-}
{- |
Special physical units: SI unit system
-}

module Number.SI.Unit where

import qualified Algebra.Transcendental      as Trans
import qualified Algebra.Field               as Field

import qualified Number.Physical.Unit         as Unit
import qualified Number.Physical.UnitDatabase as UnitDatabase
import Number.Physical.UnitDatabase(initScale, initUnitSet)
import Data.Maybe(catMaybes)

import NumericPrelude.Base hiding (length)
import NumericPrelude.Numeric hiding (one)

data Dimension =
   Length | Time | Mass | Charge |
   Angle | Temperature | Information
      deriving (Dimension -> Dimension -> Bool
(Dimension -> Dimension -> Bool)
-> (Dimension -> Dimension -> Bool) -> Eq Dimension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Dimension -> Dimension -> Bool
$c/= :: Dimension -> Dimension -> Bool
== :: Dimension -> Dimension -> Bool
$c== :: Dimension -> Dimension -> Bool
Eq, Eq Dimension
Eq Dimension
-> (Dimension -> Dimension -> Ordering)
-> (Dimension -> Dimension -> Bool)
-> (Dimension -> Dimension -> Bool)
-> (Dimension -> Dimension -> Bool)
-> (Dimension -> Dimension -> Bool)
-> (Dimension -> Dimension -> Dimension)
-> (Dimension -> Dimension -> Dimension)
-> Ord Dimension
Dimension -> Dimension -> Bool
Dimension -> Dimension -> Ordering
Dimension -> Dimension -> Dimension
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Dimension -> Dimension -> Dimension
$cmin :: Dimension -> Dimension -> Dimension
max :: Dimension -> Dimension -> Dimension
$cmax :: Dimension -> Dimension -> Dimension
>= :: Dimension -> Dimension -> Bool
$c>= :: Dimension -> Dimension -> Bool
> :: Dimension -> Dimension -> Bool
$c> :: Dimension -> Dimension -> Bool
<= :: Dimension -> Dimension -> Bool
$c<= :: Dimension -> Dimension -> Bool
< :: Dimension -> Dimension -> Bool
$c< :: Dimension -> Dimension -> Bool
compare :: Dimension -> Dimension -> Ordering
$ccompare :: Dimension -> Dimension -> Ordering
$cp1Ord :: Eq Dimension
Ord, Int -> Dimension
Dimension -> Int
Dimension -> [Dimension]
Dimension -> Dimension
Dimension -> Dimension -> [Dimension]
Dimension -> Dimension -> Dimension -> [Dimension]
(Dimension -> Dimension)
-> (Dimension -> Dimension)
-> (Int -> Dimension)
-> (Dimension -> Int)
-> (Dimension -> [Dimension])
-> (Dimension -> Dimension -> [Dimension])
-> (Dimension -> Dimension -> [Dimension])
-> (Dimension -> Dimension -> Dimension -> [Dimension])
-> Enum Dimension
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Dimension -> Dimension -> Dimension -> [Dimension]
$cenumFromThenTo :: Dimension -> Dimension -> Dimension -> [Dimension]
enumFromTo :: Dimension -> Dimension -> [Dimension]
$cenumFromTo :: Dimension -> Dimension -> [Dimension]
enumFromThen :: Dimension -> Dimension -> [Dimension]
$cenumFromThen :: Dimension -> Dimension -> [Dimension]
enumFrom :: Dimension -> [Dimension]
$cenumFrom :: Dimension -> [Dimension]
fromEnum :: Dimension -> Int
$cfromEnum :: Dimension -> Int
toEnum :: Int -> Dimension
$ctoEnum :: Int -> Dimension
pred :: Dimension -> Dimension
$cpred :: Dimension -> Dimension
succ :: Dimension -> Dimension
$csucc :: Dimension -> Dimension
Enum, Int -> Dimension -> ShowS
[Dimension] -> ShowS
Dimension -> String
(Int -> Dimension -> ShowS)
-> (Dimension -> String)
-> ([Dimension] -> ShowS)
-> Show Dimension
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Dimension] -> ShowS
$cshowList :: [Dimension] -> ShowS
show :: Dimension -> String
$cshow :: Dimension -> String
showsPrec :: Int -> Dimension -> ShowS
$cshowsPrec :: Int -> Dimension -> ShowS
Show)


-- | Some common quantity classes.
angle, angularSpeed, -- needs explicit signature because it does not occur in the database
 length, distance, area, volume, time,
 frequency, speed, acceleration, mass,
 force, pressure, energy, power,
 charge, current, voltage, resistance,
 capacitance, temperature,
 information, dataRate
  :: Unit.T Dimension

length :: T Dimension
length       = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
1, Int
0, Int
0, Int
0, Int
0, Int
0, Int
0]
-- synonym for 'length' which is distinct from List.length
distance :: T Dimension
distance     = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
1, Int
0, Int
0, Int
0, Int
0, Int
0, Int
0]
area :: T Dimension
area         = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
2, Int
0, Int
0, Int
0, Int
0, Int
0, Int
0]
volume :: T Dimension
volume       = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
3, Int
0, Int
0, Int
0, Int
0, Int
0, Int
0]
time :: T Dimension
time         = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0, Int
1, Int
0, Int
0, Int
0, Int
0, Int
0]
frequency :: T Dimension
frequency    = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0,-Int
1, Int
0, Int
0, Int
0, Int
0, Int
0]
speed :: T Dimension
speed        = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
1,-Int
1, Int
0, Int
0, Int
0, Int
0, Int
0]
acceleration :: T Dimension
acceleration = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
1,-Int
2, Int
0, Int
0, Int
0, Int
0, Int
0]
mass :: T Dimension
mass         = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0, Int
0, Int
1, Int
0, Int
0, Int
0, Int
0]
force :: T Dimension
force        = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
1,-Int
2, Int
1, Int
0, Int
0, Int
0, Int
0]
pressure :: T Dimension
pressure     = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [-Int
1,-Int
2, Int
1, Int
0, Int
0, Int
0, Int
0]
energy :: T Dimension
energy       = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
2,-Int
2, Int
1, Int
0, Int
0, Int
0, Int
0]
power :: T Dimension
power        = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
2,-Int
3, Int
1, Int
0, Int
0, Int
0, Int
0]
charge :: T Dimension
charge       = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0, Int
0, Int
0, Int
1, Int
0, Int
0, Int
0]
current :: T Dimension
current      = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0,-Int
1, Int
0, Int
1, Int
0, Int
0, Int
0]
voltage :: T Dimension
voltage      = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
2,-Int
2, Int
1,-Int
1, Int
0, Int
0, Int
0]
resistance :: T Dimension
resistance   = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
2,-Int
1, Int
1,-Int
2, Int
0, Int
0, Int
0]
capacitance :: T Dimension
capacitance  = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [-Int
2, Int
2,-Int
1, Int
2, Int
0, Int
0, Int
0]
angle :: T Dimension
angle        = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0, Int
0, Int
0, Int
0, Int
1, Int
0, Int
0]
angularSpeed :: T Dimension
angularSpeed = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0,-Int
1, Int
0, Int
0, Int
1, Int
0, Int
0]
temperature :: T Dimension
temperature  = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0, Int
0, Int
0, Int
0, Int
0, Int
1, Int
0]
information :: T Dimension
information  = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0, Int
0, Int
0, Int
0, Int
0, Int
0, Int
1]
dataRate :: T Dimension
dataRate     = [Int] -> T Dimension
forall i. (Enum i, Ord i) => [Int] -> T i
Unit.fromVector [ Int
0,-Int
1, Int
0, Int
0, Int
0, Int
0, Int
1]


percent, fourth, half, threeFourth   :: Field.C a => a

secondsPerMinute, secondsPerHour, secondsPerDay, secondsPerYear, 
 meterPerInch, meterPerFoot, meterPerYard,
 meterPerAstronomicUnit, meterPerParsec, 
 accelerationOfEarthGravity,
 k2, deg180, grad200, bytesize       :: Field.C a => a

radPerDeg, radPerGrad                :: Trans.C a => a

mach, speedOfLight, electronVolt,
 calorien, horsePower                :: Field.C a => a

yocto, zepto, atto, femto, pico,
 nano, micro, milli, centi, deci,
 one, deca, hecto, kilo, mega,
 giga, tera, peta, exa, zetta, yotta :: Field.C a => a

-- | Common constants
percent :: a
percent      = a
0.01
fourth :: a
fourth       = a
0.25
half :: a
half         = a
0.50
threeFourth :: a
threeFourth  = a
0.75

-- | Conversion factors
secondsPerMinute :: a
secondsPerMinute = a
60
secondsPerHour :: a
secondsPerHour   = a
60a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
secondsPerMinute
secondsPerDay :: a
secondsPerDay    = a
24a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
secondsPerHour  -- 86400.0
secondsPerYear :: a
secondsPerYear   = a
365.2422a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
secondsPerDay

meterPerInch :: a
meterPerInch           = a
0.0254
meterPerFoot :: a
meterPerFoot           = a
0.3048
meterPerYard :: a
meterPerYard           = a
0.9144
meterPerAstronomicUnit :: a
meterPerAstronomicUnit = a
149.6e6
meterPerParsec :: a
meterPerParsec         = a
30.857e12

k2 :: a
k2           = a
1024
deg180 :: a
deg180       = a
180
grad200 :: a
grad200      = a
200
radPerDeg :: a
radPerDeg    = a
forall a. C a => a
pia -> a -> a
forall a. C a => a -> a -> a
/a
forall a. C a => a
deg180;
radPerGrad :: a
radPerGrad   = a
forall a. C a => a
pia -> a -> a
forall a. C a => a -> a -> a
/a
forall a. C a => a
grad200;
bytesize :: a
bytesize     = a
8



-- | Physical constants
accelerationOfEarthGravity :: a
accelerationOfEarthGravity = a
9.80665
mach :: a
mach                       = a
332.0
speedOfLight :: a
speedOfLight               = a
299792458.0
electronVolt :: a
electronVolt               = a
1.602e-19
calorien :: a
calorien                   = a
4.19
horsePower :: a
horsePower                 = a
736.0

-- | Prefixes used for SI units
yocto :: a
yocto = a
1.0e-24
zepto :: a
zepto = a
1.0e-21
atto :: a
atto  = a
1.0e-18
femto :: a
femto = a
1.0e-15
pico :: a
pico  = a
1.0e-12
nano :: a
nano  = a
1.0e-9
micro :: a
micro = a
1.0e-6
milli :: a
milli = a
1.0e-3
centi :: a
centi = a
1.0e-2
deci :: a
deci  = a
1.0e-1
one :: a
one   = a
1.0e0
deca :: a
deca  = a
1.0e1
hecto :: a
hecto = a
1.0e2
kilo :: a
kilo  = a
1.0e3
mega :: a
mega  = a
1.0e6
giga :: a
giga  = a
1.0e9
tera :: a
tera  = a
1.0e12
peta :: a
peta  = a
1.0e15
exa :: a
exa   = a
1.0e18
zetta :: a
zetta = a
1.0e21
yotta :: a
yotta = a
1.0e24



{- | UnitDatabase.T of units and their common scalings -}
databaseRead, databaseShow :: Trans.C a => UnitDatabase.T Dimension a
databaseRead :: T Dimension a
databaseRead = (InitUnitSet Dimension a -> UnitSet Dimension a)
-> [InitUnitSet Dimension a] -> T Dimension a
forall a b. (a -> b) -> [a] -> [b]
map InitUnitSet Dimension a -> UnitSet Dimension a
forall i a. InitUnitSet i a -> UnitSet i a
UnitDatabase.createUnitSet [InitUnitSet Dimension a]
forall a. C a => [InitUnitSet Dimension a]
database
databaseShow :: T Dimension a
databaseShow =
   (InitUnitSet Dimension a -> UnitSet Dimension a)
-> [InitUnitSet Dimension a] -> T Dimension a
forall a b. (a -> b) -> [a] -> [b]
map InitUnitSet Dimension a -> UnitSet Dimension a
forall i a. InitUnitSet i a -> UnitSet i a
UnitDatabase.createUnitSet ([InitUnitSet Dimension a] -> T Dimension a)
-> [InitUnitSet Dimension a] -> T Dimension a
forall a b. (a -> b) -> a -> b
$
      [Maybe (InitUnitSet Dimension a)] -> [InitUnitSet Dimension a]
forall a. [Maybe a] -> [a]
catMaybes ([Maybe (InitUnitSet Dimension a)] -> [InitUnitSet Dimension a])
-> [Maybe (InitUnitSet Dimension a)] -> [InitUnitSet Dimension a]
forall a b. (a -> b) -> a -> b
$ (InitUnitSet Dimension a -> Maybe (InitUnitSet Dimension a))
-> [InitUnitSet Dimension a] -> [Maybe (InitUnitSet Dimension a)]
forall a b. (a -> b) -> [a] -> [b]
map InitUnitSet Dimension a -> Maybe (InitUnitSet Dimension a)
forall i a. InitUnitSet i a -> Maybe (InitUnitSet i a)
UnitDatabase.showableUnit [InitUnitSet Dimension a]
forall a. C a => [InitUnitSet Dimension a]
database

database :: Trans.C a => [UnitDatabase.InitUnitSet Dimension a]
database :: [InitUnitSet Dimension a]
database = [
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
forall i. T i
Unit.scalar Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"pi"    a
forall a. C a => a
pi                        Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"e"     (a -> a
forall a. C a => a -> a
exp a
1)                   Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"i"     (a -> a
forall a. C a => a -> a
sqrt (-a
1))               Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"%"     a
forall a. C a => a
percent                   Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\188"  a
forall a. C a => a
fourth                    Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\189"  a
forall a. C a => a
half                      Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\190"  a
forall a. C a => a
threeFourth               Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
angle Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"''"    (a
forall a. C a => a
radPerDega -> a -> a
forall a. C a => a -> a -> a
/a
forall a. C a => a
secondsPerHour)   Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"'"     (a
forall a. C a => a
radPerDega -> a -> a
forall a. C a => a -> a -> a
/a
forall a. C a => a
secondsPerMinute) Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"grad"  a
forall a. C a => a
radPerGrad                Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\176"  a
forall a. C a => a
radPerDeg                 Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"rad"   a
forall a. C a => a
one                       Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
frequency Bool
True [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"bpm"   (a
forall a. C a => a
onea -> a -> a
forall a. C a => a -> a -> a
/a
forall a. C a => a
secondsPerMinute)    Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"Hz"    a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kHz"   a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"MHz"   a
forall a. C a => a
mega                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"GHz"   a
forall a. C a => a
giga                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
time Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"ns"    a
forall a. C a => a
nano                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\181s" a
forall a. C a => a
micro                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"ms"    a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"s"     a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"min"   a
forall a. C a => a
secondsPerMinute          Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"h"     a
forall a. C a => a
secondsPerHour            Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"d"     a
forall a. C a => a
secondsPerDay             Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"a"     a
forall a. C a => a
secondsPerYear            Bool
True  Bool
False)
    ]),
--    (initUnitSet distance False [
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
length Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"nm"    a
forall a. C a => a
nano                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\181m" a
forall a. C a => a
micro                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mm"    a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"cm"    a
forall a. C a => a
centi                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"dm"    a
forall a. C a => a
deci                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"m"     a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"km"    a
forall a. C a => a
kilo                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
area Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"ha"    (a
forall a. C a => a
hectoa -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
hecto)             Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
volume Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"ml"    (a
forall a. C a => a
millia -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
milli)             Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"cl"    (a
forall a. C a => a
millia -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
centi)             Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"l"     a
forall a. C a => a
milli                     Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
speed Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mach"  a
forall a. C a => a
mach                      Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"c"     a
forall a. C a => a
speedOfLight              Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
acceleration Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"G"     a
forall a. C a => a
accelerationOfEarthGravity Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
mass Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\181g" a
forall a. C a => a
nano                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mg"    a
forall a. C a => a
micro                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"g"     a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kg"    a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"dt"    a
forall a. C a => a
hecto                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"t"     a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kt"    a
forall a. C a => a
mega                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
force Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"N"     a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kp"    a
forall a. C a => a
accelerationOfEarthGravity Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kN"    a
forall a. C a => a
kilo                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
pressure Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"Pa"    a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mbar"  a
forall a. C a => a
hecto                     Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kPa"   a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"bar"   (a
forall a. C a => a
hectoa -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
kilo)              Bool
False Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
energy Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"eV"    a
forall a. C a => a
electronVolt              Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"J"     a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"cal"   a
forall a. C a => a
calorien                  Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kJ"    a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kcal"  (a
forall a. C a => a
kiloa -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
calorien)           Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"MJ"    a
forall a. C a => a
mega                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
power Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mW"    a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"W"     a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"HP"    a
forall a. C a => a
horsePower                Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kW"    a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"MW"    a
forall a. C a => a
mega                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
charge Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"C"     a
forall a. C a => a
one                       Bool
True  Bool
True )
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
current Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\181A" a
forall a. C a => a
micro                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mA"    a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"A"     a
forall a. C a => a
one                       Bool
True  Bool
True )
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
voltage Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mV"    a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"V"     a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kV"    a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"MV"    a
forall a. C a => a
mega                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"GV"    a
forall a. C a => a
giga                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
resistance Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"Ohm"   a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kOhm"  a
forall a. C a => a
kilo                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"MOhm"  a
forall a. C a => a
mega                      Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
capacitance Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"pF"    a
forall a. C a => a
pico                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"nF"    a
forall a. C a => a
nano                      Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"\181F" a
forall a. C a => a
micro                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"mF"    a
forall a. C a => a
milli                     Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"F"     a
forall a. C a => a
one                       Bool
True  Bool
True )
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
temperature Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"K"     a
forall a. C a => a
one                       Bool
True  Bool
True )
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
information Bool
False [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"bit"   a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"B"     a
forall a. C a => a
bytesize                  Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kB"    (a
forall a. C a => a
kiloa -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
bytesize)           Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"KB"    (a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
bytesize)             Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"MB"    (a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
bytesize)          Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"GB"    (a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
bytesize)       Bool
True  Bool
False)
    ]),
    (T Dimension -> Bool -> [InitScale a] -> InitUnitSet Dimension a
forall i a. T i -> Bool -> [InitScale a] -> InitUnitSet i a
initUnitSet T Dimension
dataRate Bool
True [
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"baud"  a
forall a. C a => a
one                       Bool
True  Bool
True ),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"kbaud" a
forall a. C a => a
kilo                      Bool
False Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"Kbaud" a
forall a. C a => a
k2                        Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"Mbaud" (a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
k2)                   Bool
True  Bool
False),
      (String -> a -> Bool -> Bool -> InitScale a
forall a. String -> a -> Bool -> Bool -> InitScale a
initScale String
"Gbaud" (a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
k2a -> a -> a
forall a. C a => a -> a -> a
*a
forall a. C a => a
k2)                Bool
True  Bool
False)
    ])
  ]