-
Notifications
You must be signed in to change notification settings - Fork 0
/
USVolume.elm
57 lines (52 loc) · 1.17 KB
/
USVolume.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
module USVolume
( teaspoon
, tablespoon
, fluidOunce
, cup
, pint
, quart
, gallon
, barrel
, oilBarrel
) where
{-| US units of volume.
@docs teaspoon, tablespoon, fluidOunce, cup, pint, quart, gallon, barrel,
oilBarrel
-}
import Ratio
import SI (..)
import Units (..)
-- All these units are defined in terms of SI units.
cubicMeter : Unit
cubicMeter = meter `pow` (Ratio.fromInt 3)
liter : Unit
liter = scale 0.001 cubicMeter
ml : Unit
ml = scale 0.001 liter
{-| One teaspoon. -}
teaspoon : Unit
teaspoon = scale 4.92892159375 ml
{-| One tablespoon. -}
tablespoon : Unit
tablespoon = scale 3 teaspoon
{-| One US fluid ounce. -}
fluidOunce : Unit
fluidOunce = scale 2 tablespoon
{-| One US cup, or eight US fluid ounces. -}
cup : Unit
cup = scale 8 fluidOunce
{-| One US pint, or two US cups. -}
pint : Unit
pint = scale 2 cup
{-| One US quart, or two US pints. -}
quart : Unit
quart = scale 2 pint
{-| One US gallon, or four US quarts. -}
gallon : Unit
gallon = scale 4 quart
{-| One barrel, or 31.5 US gallons. -}
barrel : Unit
barrel = scale 31.5 gallon
{-| One petroleum barrel, or 42 US gallons. -}
oilBarrel : Unit
oilBarrel = scale 42 gallon