Quantities
- Package
- purescript-quantities
- Repository
- sharkdp/purescript-quantities
A helper module which re-exports all sub-modules.
Re-exports from Data.Quantity
#ConversionError Source
data ConversionErrorA unit conversion error that appears if two given units cannot be converted into each other.
Constructors
Instances
#toStandard Source
toStandard :: Quantity -> QuantityConvert a quantity to its standard representation.
#toScalar' Source
toScalar' :: Quantity -> Either ConversionError DecimalTry to convert a quantity to a scalar value
#toScalar Source
toScalar :: Quantity -> Either ConversionError NumberTry to convert a quantity to a scalar value
#showResult Source
showResult :: Either ConversionError Quantity -> StringShow the (possibly failed) result of a computation in human-readable form.
#quantity' Source
quantity' :: Decimal -> DerivedUnit -> QuantityConstruct a physical quantity from a numerical value and the physical unit.
#quantity Source
quantity :: Number -> DerivedUnit -> QuantityConstruct a physical quantity from a numerical value and the physical unit.
#prettyPrint' Source
prettyPrint' :: Quantity -> { number :: String, space :: Boolean, unit :: String }Show a physical quantity in a human-readable form, value and unit separately.
#prettyPrint Source
prettyPrint :: Quantity -> StringShow a physical quantity in a human-readable form.
#fullSimplify Source
fullSimplify :: Quantity -> QuantityAttempt to simplify the unit of a quantity.
#errorMessage Source
errorMessage :: ConversionError -> StringTextual representation of a unit conversion error.
#derivedUnit Source
derivedUnit :: Quantity -> DerivedUnitThe unit of a physical quantity.
#convertTo Source
convertTo :: Quantity -> DerivedUnit -> Either ConversionError QuantityFlipped version of convert.
#convert Source
convert :: DerivedUnit -> Quantity -> Either ConversionError QuantityAttempt to convert a physical quantity to a given target unit. Returns a
ConversionError if the conversion fails.
#asValueIn' Source
asValueIn' :: Quantity -> DerivedUnit -> Either ConversionError DecimalGet the numerical value of a physical quantity in a given unit. Returns a
ConversionError if the conversion fails.
#asValueIn Source
asValueIn :: Quantity -> DerivedUnit -> Either ConversionError NumberGet the numerical value of a physical quantity in a given unit. Returns a
ConversionError if the conversion fails.
#approximatelyEqual Source
approximatelyEqual :: Number -> Quantity -> Quantity -> BooleanCheck whether two quantities have matching units (or can be converted to the same representation) and test if the numerical values are approximately equal.
Re-exports from Data.Quantity.Math
Re-exports from Data.Quantity.Physics
#speedOfLight Source
speedOfLight :: QuantityThe speed of light in vacuum.
#protonMass Source
protonMass :: QuantityMass of the proton.
#planckConstant Source
planckConstant :: QuantityThe Planck constant.
#gravitationalConstant Source
gravitationalConstant :: QuantityThe Newtonian constant of gravitation.
#electronMass Source
electronMass :: QuantityThe mass of the electron.
#electronCharge Source
electronCharge :: QuantityElementary charge (charge of the electron).
#avogadroConstant Source
avogadroConstant :: QuantityAvogadro's number.
Re-exports from Data.Units
#DerivedUnit Source
data DerivedUnitA generic physical unit. The Semigroup/Monoid instance implements
multiplication of units.
Implementation detail:
A DerivedUnit is a product of BaseUnits, raised to arbitrary powers.
Each factor also has a Prefix value which represents a numerical
prefix as a power of ten or two.
Instances
#zebi Source
zebi :: DerivedUnit -> DerivedUnit#yobi Source
yobi :: DerivedUnit -> DerivedUnit#unity Source
unity :: DerivedUnitA DerivedUnit corresponding to 1, i.e. the unit of scalar
(or dimensionless) values.
#toString Source
toString :: DerivedUnit -> StringA human-readable String representation of a DerivedUnit.
#toStandardUnit Source
toStandardUnit :: DerivedUnit -> Tuple DerivedUnit ConversionFactorConvert all contained units to standard units and return the global conversion factor.
#tera Source
tera :: DerivedUnit -> DerivedUnit#tebi Source
tebi :: DerivedUnit -> DerivedUnit#splitByDimension Source
splitByDimension :: DerivedUnit -> List (Tuple DerivedUnit DerivedUnit)Split up a physical unit into several parts that belong to the same physical dimension (length, time, ...). In the first component, the returned tuples contain a 'target' unit, to which this group can be converted. In the second component, the original group is returned.
#simplify Source
simplify :: DerivedUnit -> DerivedUnitSimplify the internal representation of a DerivedUnit by merging base
units of the same type. For example, m·s·m will by simplified to m²·s.
#removePrefix Source
removePrefix :: DerivedUnit -> DerivedUnitRemove all prefix values from the unit:
removePrefix (kilo meter <> milli second) = meter <> second
#power Source
power :: DerivedUnit -> Number -> DerivedUnitRaise a unit to the given power.
#pico Source
pico :: DerivedUnit -> DerivedUnit#peta Source
peta :: DerivedUnit -> DerivedUnit#pebi Source
pebi :: DerivedUnit -> DerivedUnit#nano Source
nano :: DerivedUnit -> DerivedUnit#milli Source
milli :: DerivedUnit -> DerivedUnit#micro Source
micro :: DerivedUnit -> DerivedUnit#mega Source
mega :: DerivedUnit -> DerivedUnit#mebi Source
mebi :: DerivedUnit -> DerivedUnit#makeStandard Source
makeStandard :: String -> String -> DerivedUnitHelper function to create a standard unit.
#makeNonStandard Source
makeNonStandard :: String -> String -> Number -> DerivedUnit -> DerivedUnitHelper function to create a non-standard unit.
#kilo Source
kilo :: DerivedUnit -> DerivedUnit#kibi Source
kibi :: DerivedUnit -> DerivedUnit#hecto Source
hecto :: DerivedUnit -> DerivedUnit#giga Source
giga :: DerivedUnit -> DerivedUnit#gibi Source
gibi :: DerivedUnit -> DerivedUnit#femto Source
femto :: DerivedUnit -> DerivedUnit#exbi Source
exbi :: DerivedUnit -> DerivedUnit#exa Source
exa :: DerivedUnit -> DerivedUnit#divideUnits Source
divideUnits :: DerivedUnit -> DerivedUnit -> DerivedUnitDivide two units.
#decimalPrefix Source
decimalPrefix :: Number -> DerivedUnit -> DerivedUnitAdd a given decimal prefix value to a unit: withDecimal 3.0 meter = kilo meter.
#deci Source
deci :: DerivedUnit -> DerivedUnit#centi Source
centi :: DerivedUnit -> DerivedUnit#binaryPrefix Source
binaryPrefix :: Number -> DerivedUnit -> DerivedUnitAdd a given binary prefix value to a unit: withDecimal 10.0 byte = kibi byte.
#baseRepresentation Source
baseRepresentation :: DerivedUnit -> List DerivedUnitReturn a representation of the DerivedUnit in terms of base units, split
by physical dimension.
#atto Source
atto :: DerivedUnit -> DerivedUnitRe-exports from Data.Units.Astronomical
#parsec Source
parsec :: DerivedUnitUnit of length, 1 parsec = 3.085677581×10^16 m.
#lightyear Source
lightyear :: DerivedUnitUnit of length, 1 ly = 9460730472580800 m.
Re-exports from Data.Units.Bit
#byte Source
byte :: DerivedUnitUnit of digital information, 1 byte = 8 bit.
#bit Source
bit :: DerivedUnitUnit of digital information.
Re-exports from Data.Units.CGS
#gauss Source
gauss :: DerivedUnitUnit of magnetic flux density, 1 G = 100 µT.
Re-exports from Data.Units.Currency
#euro Source
euro :: DerivedUnitThe official currency of the European Union
#dollar Source
dollar :: DerivedUnitThe United States dollar.
Re-exports from Data.Units.Imperial
#yard Source
yard :: DerivedUnitUnit of length, 1 yd = 0.9144 m.
#thou Source
thou :: DerivedUnitUnit of length, 1 thou = 1 thousandth of an inch.
#pound Source
pound :: DerivedUnitUnit of mass, 1 lb = 453.6 g.
#ounce Source
ounce :: DerivedUnitUnit of mass, 1 oz = 28.35 g.
#mile Source
mile :: DerivedUnitUnit of length, 1 mi = 1609.344 m.
#inch Source
inch :: DerivedUnitUnit of length, 1 in = 0.0254 m.
#furlong Source
furlong :: DerivedUnitUnit of length, 1 furlong = 201.1680 m.
#foot Source
foot :: DerivedUnitUnit of length, 1 ft = 0.3048 m.
Re-exports from Data.Units.Misc
#rpm Source
rpm :: DerivedUnitUnit of frequency, 1 rpm = 1/min.
#psi Source
psi :: DerivedUnitUnit of pressure, 1 psi = 6.894757 kPa.
#pixel Source
pixel :: DerivedUnitSmallest addressable element on a digital display.
#piece Source
piece :: DerivedUnitA separate or limited portion or quantity of something.
#person Source
person :: DerivedUnitA human being.
#ozf Source
ozf :: DerivedUnitUnit of force, 1 ozf = 16 lbf.
#mmHg Source
mmHg :: DerivedUnitUnit of pressure, 1 mmHg = 133.322387415 Pa.
#lbf Source
lbf :: DerivedUnitUnit of force, 1 lbf = 4.448222 N.
#frame Source
frame :: DerivedUnitA single image in a (video) sequence.
#fortnight Source
fortnight :: DerivedUnitUnit of time, 1 fortnight = 2 weeks.
#dot Source
dot :: DerivedUnitSmallest possible output resolution on a printing device.
#calorie Source
calorie :: DerivedUnitUnit of energy, 1 cal = 4.184 J.
#btu Source
btu :: DerivedUnitUnit of energy, 1 BTU = 1055.05585262 J.
#atm Source
atm :: DerivedUnitUnit of pressure, 1 atm = 101325 Pa.
Re-exports from Data.Units.Nautical
#knot Source
knot :: DerivedUnitRe-exports from Data.Units.PartsPerX
#percent Source
percent :: DerivedUnit'Dimensionless' ratio 1 pct = 1e-2.
#partsPerTrillion Source
partsPerTrillion :: DerivedUnit'Dimensionless' ratio 1 ppt = 1e-12.
#partsPerQuadrillion Source
partsPerQuadrillion :: DerivedUnit'Dimensionless' ratio 1 ppq = 1e-15.
#partsPerMillion Source
partsPerMillion :: DerivedUnit'Dimensionless' ratio 1 ppm = 1e-6.
#partsPerBillion Source
partsPerBillion :: DerivedUnit'Dimensionless' ratio 1 ppb = 1e-9.
Re-exports from Data.Units.SI
#second Source
second :: DerivedUnitThe second is the standard unit of time.
#mole Source
mole :: DerivedUnitThe mole is the standard unit for amount of substance.
#meter Source
meter :: DerivedUnitThe meter is the standard unit of length.
#kilogram Source
kilogram :: DerivedUnitThe kilogram is the standard unit of mass.
#kelvin Source
kelvin :: DerivedUnitThe kelvin is the standard unit of temperature.
#gram Source
gram :: DerivedUnitOne gram equals one-thousandth of a kilogram.
#candela Source
candela :: DerivedUnitThe candela is the standard unit of luminous intensity.
#ampere Source
ampere :: DerivedUnitThe ampere is the standard unit of electric current.
Re-exports from Data.Units.SI.Accepted
#tonne Source
tonne :: DerivedUnitUnit of mass, 1 t = 10³ km.
#liter Source
liter :: DerivedUnitUnit of volume, 1 L = 1 dm³.
#hectare Source
hectare :: DerivedUnitUnit of area, 1 ha = 10000 m².
#electronvolt Source
electronvolt :: DerivedUnitUnit of energy, 1 eV = 1.60217653·10^(−19) J.
#degree Source
degree :: DerivedUnit'Dimensionless' unit for angles 360 degree = 2·pi rad.
#bel Source
bel :: DerivedUnitUnit for expressing ratios of two values of a physical quantity.
#barn Source
barn :: DerivedUnitUnit of area, 1 barn = 10^(-28) m^2.
#bar Source
bar :: DerivedUnitUnit of pressure, 1 bar = 10^5 Pa.
#astronomicalUnit Source
astronomicalUnit :: DerivedUnitUnit of length, 1 AU = 1.495978707·10^11 m.
#angstrom Source
angstrom :: DerivedUnitUnit of length, 1 Å = 10^(-10) m.
Re-exports from Data.Units.SI.Derived
#weber Source
weber :: DerivedUnitUnit of magnetic flux, 1 Wb = 1 V·s.
#watt Source
watt :: DerivedUnitUnit of power, 1 W = 1 J/s.
#volt Source
volt :: DerivedUnitUnit of voltage, 1 V = 1 W/A.
#tesla Source
tesla :: DerivedUnitUnit of magnetic flux density, 1 T = 1 Wb/m².
#steradian Source
steradian :: DerivedUnit'Dimensionless' unit for solid angles 1 sr = 1 m²/m².
#sievert Source
sievert :: DerivedUnitUnit of equivalent dose, 1 Sv = 1 J/kg.
#siemens Source
siemens :: DerivedUnitUnit of electrical conductance, 1 S = 1 A/V.
#radian Source
radian :: DerivedUnit'Dimensionless' unit for angles 1 rad = 1 m/m.
#pascal Source
pascal :: DerivedUnitUnit of pressure, 1 Pa = 1 N/m².
#ohm Source
ohm :: DerivedUnitUnit of electric resistance, 1 Ω = 1 V/A.
#newton Source
newton :: DerivedUnitUnit of force, 1 N = 1 kg·m/s².
#lux Source
lux :: DerivedUnitUnit of illuminance, 1 lx = 1 lm/m².
#lumen Source
lumen :: DerivedUnitUnit of luminous flux, 1 lm = 1 cd·sr.
#katal Source
katal :: DerivedUnitUnit of catalytic activity, 1 kat = 1 mol/s.
#joule Source
joule :: DerivedUnitUnit of energy, 1 J = 1 N·m.
#hertz Source
hertz :: DerivedUnitUnit of frequency, 1 Hz = 1 / s.
#henry Source
henry :: DerivedUnitUnit of inductance, 1 H = 1 Wb/A.
#gray Source
gray :: DerivedUnitUnit of absorbed dose, 1 Gy = 1 J/kg.
#farad Source
farad :: DerivedUnitUnit of capacitance, 1 F = 1 C/V.
#coulomb Source
coulomb :: DerivedUnitUnit of electric charge, 1 C = 1 A·s.
#becquerel Source
becquerel :: DerivedUnitUnit of radioactivity (decays per time), 1 Bq = 1/s.
Re-exports from Data.Units.Time
#year Source
year :: DerivedUnitUnit of time, 1 year = 365.2425 days (Gregorian year).
#week Source
week :: DerivedUnitUnit of time, 1 week = 7 days.
#month Source
month :: DerivedUnitUnit of time, 1 month = 30 days + 10 hours + 29 minutes + 10 seconds.
#minute Source
minute :: DerivedUnitUnit of time, 1 min = 60 sec.
#julianYear Source
julianYear :: DerivedUnitUnit of time, 1 julianYear = 365.25 days.
#hour Source
hour :: DerivedUnitUnit of time, 1 hour = 60 min.
#day Source
day :: DerivedUnitUnit of time, 1 day = 24 hour.
Re-exports from Data.Units.USCustomary
#teaspoon Source
teaspoon :: DerivedUnitUnit of volume, the US teaspoon, 1 teaspoon = 1/3·tablespoon.
#tablespoon Source
tablespoon :: DerivedUnitUnit of volume, the US tablespoon, 1 tablespoon = 1/16·cup.
#rod Source
rod :: DerivedUnitUnit of length, the US rod, 1 rod = 16.5 ft.
#pint Source
pint :: DerivedUnitUnit of volume, the US liquid pint, 1 pint = 1/8·gal.
#hogshead Source
hogshead :: DerivedUnitUnit of volume, the US hogshead, 1 hogshead = 63 gal.
#gallon Source
gallon :: DerivedUnitUnit of volume, the US liquid gallon, 1 gal = 0.003785411784 m^3 = 231 in^3
#fluidounce Source
fluidounce :: DerivedUnitUnit of volume, the US fluid ounce, 1 floz = 2 tablespoon.
#cup Source
cup :: DerivedUnitUnit of volume, the US cup, 1 cup = 1/2·pint.
- Modules
- Data.
Quantity - Data.
Quantity. Math - Data.
Quantity. Physics - Data.
Units - Data.
Units. Astronomical - Data.
Units. Bit - Data.
Units. CGS - Data.
Units. Currency - Data.
Units. Imperial - Data.
Units. Misc - Data.
Units. Nautical - Data.
Units. PartsPerX - Data.
Units. SI - Data.
Units. SI. Accepted - Data.
Units. SI. Derived - Data.
Units. Time - Data.
Units. USCustomary - Quantities