Quantities
- Package
- purescript-quantities
- Repository
- sharkdp/purescript-quantities
A helper module which re-exports all sub-modules.
Re-exports from Data.Quantity 
#UnificationError Source
data UnificationErrorA 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 UnificationError DecimalTry to convert a quantity to a scalar value
#toScalar Source
toScalar :: Quantity -> Either UnificationError NumberTry to convert a quantity to a scalar value
#showResult Source
showResult :: Either UnificationError 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 -> Tuple String StringShow 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 :: UnificationError -> StringTextual representation of a unit conversion error.
#derivedUnit Source
derivedUnit :: Quantity -> DerivedUnitThe unit of a physical quantity.
#convertTo Source
convertTo :: Quantity -> DerivedUnit -> Either UnificationError QuantityFlipped version of convert.
#convert Source
convert :: DerivedUnit -> Quantity -> Either UnificationError QuantityAttempt to convert a physical quantity to a given target unit. Returns a
UnificationError if the conversion fails.
#asValueIn' Source
asValueIn' :: Quantity -> DerivedUnit -> Either UnificationError DecimalGet the numerical value of a physical quantity in a given unit. Returns a
UnificationError if the conversion fails.
#asValueIn Source
asValueIn :: Quantity -> DerivedUnit -> Either UnificationError NumberGet the numerical value of a physical quantity in a given unit. Returns a
UnificationError 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.
Instances
#withPrefix Source
withPrefix :: Number -> DerivedUnit -> DerivedUnitAdd a given prefix value to a unit: withPrefix 3.0 meter = kilo meter.
#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#splitByDimension Source
splitByDimension :: DerivedUnit -> List (Tuple DerivedUnit DerivedUnit)Split up a physical units 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#nano Source
nano :: DerivedUnit -> DerivedUnit#milli Source
milli :: DerivedUnit -> DerivedUnit#micro Source
micro :: DerivedUnit -> DerivedUnit#mega Source
mega :: 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#hecto Source
hecto :: DerivedUnit -> DerivedUnit#giga Source
giga :: DerivedUnit -> DerivedUnit#femto Source
femto :: DerivedUnit -> DerivedUnit#exa Source
exa :: DerivedUnit -> DerivedUnit#divideUnits Source
divideUnits :: DerivedUnit -> DerivedUnit -> DerivedUnitDivide two units.
#deci Source
deci :: DerivedUnit -> DerivedUnit#centi Source
centi :: DerivedUnit -> DerivedUnit#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.Bit  
#byte Source
byte :: DerivedUnitUnit of digital information, 1byte = 8bit.
#bit Source
bit :: DerivedUnitUnit of digital information.
Re-exports from Data.Units.Imperial  
#yard Source
yard :: DerivedUnitUnit of length, 1yd = 0.9144m.
#pound Source
pound :: DerivedUnitUnit of mass, 1lb = 453.6g.
#ounce Source
ounce :: DerivedUnitUnit of mass, 1oz = 28.35g.
#mile Source
mile :: DerivedUnitUnit of length, 1mi = 1609.344m.
#inch Source
inch :: DerivedUnitUnit of length, 1in = 0.0254m.
#foot Source
foot :: DerivedUnitUnit of length, 1ft = 0.3048m.
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, 1t = 10³ km.
#liter Source
liter :: DerivedUnitUnit of volume, 1L = 1dm³.
#hectare Source
hectare :: DerivedUnitUnit of area, 1ha = 10000m².
#electronvolt Source
electronvolt :: DerivedUnitUnit of energy, 1eV = 1.60217653·10^(−19) J.
#degree Source
degree :: DerivedUnit'Dimensionless' unit for angles 360 degree = 2 pi rad.
Re-exports from Data.Units.SI.Derived   
#weber Source
weber :: DerivedUnitUnit of magnetic flux, 1Wb = 1V·s.
#watt Source
watt :: DerivedUnitUnit of power, 1W = 1J/s.
#volt Source
volt :: DerivedUnitUnit of voltage, 1V = 1W/A.
#tesla Source
tesla :: DerivedUnitUnit of magnetic flux density, 1T = 1Wb/m².
#steradian Source
steradian :: DerivedUnit'Dimensionless' unit for solid angles 1 sr = 1m² / 1m².
#sievert Source
sievert :: DerivedUnitUnit of equivalent dose, 1Sv = 1J/kg.
#siemens Source
siemens :: DerivedUnitUnit of electrical conductance, 1S = 1A/V.
#radian Source
radian :: DerivedUnit'Dimensionless' unit for angles 1 rad = 1m / 1m.
#pascal Source
pascal :: DerivedUnitUnit of pressure, 1Pa = 1N/m².
#ohm Source
ohm :: DerivedUnitUnit of electric resistance, 1Ω = 1V/A.
#newton Source
newton :: DerivedUnitUnit of force, 1N = 1kg⋅m/s².
#lux Source
lux :: DerivedUnitUnit of illuminance, 1lx = 1lm/m².
#lumen Source
lumen :: DerivedUnitUnit of luminous flux, 1lm = 1cd·sr.
#katal Source
katal :: DerivedUnitUnit of catalytic activity, 1kat = 1mol/s.
#joule Source
joule :: DerivedUnitUnit of energy, 1J = 1N·m.
#hertz Source
hertz :: DerivedUnitUnit of frequency, 1 Hz = 1 / s.
#henry Source
henry :: DerivedUnitUnit of inductance, 1H = 1Wb/A.
#gray Source
gray :: DerivedUnitUnit of absorbed dose, 1Gy = 1J/kg.
#farad Source
farad :: DerivedUnitUnit of capacitance, 1F = 1C/V.
#coulomb Source
coulomb :: DerivedUnitUnit of electric charge, 1C = 1A·s.
#becquerel Source
becquerel :: DerivedUnitUnit of radioactivity (decays per time), 1Bq = 1/s.
Re-exports from Data.Units.Time  
#year Source
year :: DerivedUnitUnit of time, 1year = 365days.
#week Source
week :: DerivedUnitUnit of time, 1week = 7days.
#month Source
month :: DerivedUnitUnit of time, 1month = 30days + 10hours.
#minute Source
minute :: DerivedUnitUnit of time, 1min = 60sec.
#hour Source
hour :: DerivedUnitUnit of time, 1hour = 60min.
#day Source
day :: DerivedUnitUnit of time, 1day = 24hour.
Re-exports from Data.Units.USCustomary  
#teaspoon Source
teaspoon :: DerivedUnitUnit of Volume, the US teaspoon, 1teaspoon = 1/3·tablespoon.
#tablespoon Source
tablespoon :: DerivedUnitUnit of Volume, the US tablespoon, 1tablespoon = 1/16·cup.
#pint Source
pint :: DerivedUnitUnit of Volume, the US liquid pint, 1pint = 1/8·gal.
#gallon Source
gallon :: DerivedUnitUnit of Volume, the US liquid gallon, 1gal = 0.003785411784m^3 = 231in^3
#cup Source
cup :: DerivedUnitUnit of Volume, the US cup, 1cup = 1/2·pint.