ianmackenzie/elm-units/2.3.0

NOTE: the latest version is 2.10.0

Mass

A Mass represents a mass in kilograms, pounds, metric or imperial tons etc. It is stored as a number of kilograms.

type alias Mass =

Metric

kilograms : Float -> Mass

Construct a mass from a number of kilograms.

inKilograms : Mass -> Float

Convert a mass to a number of kilograms.

grams : Float -> Mass

Construct a mass from a number of grams.

inGrams : Mass -> Float

Convert a mass to a number of grams.

metricTons : Float -> Mass

Construct a mass from a number of metric tons.

Mass.metricTons 1
--> Mass.kilograms 1000
inMetricTons : Mass -> Float

Convert a mass to a number of metric tons.

Imperial

pounds : Float -> Mass

Construct a mass from a number of pounds.

inPounds : Mass -> Float

Convert a mass to a number of pounds.

ounces : Float -> Mass

Construct a mass from a number of ounces.

inOunces : Mass -> Float

Convert a mass to a number of ounces.

Mass.pounds 1 |> Mass.inOunces
--> 16
longTons : Float -> Mass

Construct a mass from a number of long tons. This is the 'ton' commonly used in the United Kingdom and British Commonwealth.

Mass.longTons 1
--> Mass.pounds 2240
inLongTons : Mass -> Float

Convert a mass to a number of long tons.

U.S. customary

shortTons : Float -> Mass

Construct a mass from a number of short tons. This is the 'ton' commonly used in the United States.

Mass.shortTons 1
--> Mass.pounds 2000
inShortTons : Mass -> Float

Convert a mass to a number of short tons.

Constants

Shorthand for Mass.kilograms 1, Mass.shortTons 1 etc. Can be convenient to use with Quantity.per.

kilogram : Mass
gram : Mass
metricTon : Mass
pound : Mass
ounce : Mass
longTon : Mass
shortTon : Mass