module UnitTyped.Currency where
import UnitTyped
import UnitTyped.SI.Meta
data Currency
type CurrencyUnit = UnitCons Currency (Pos One) UnitNil
data Euro
instance Convertable CurrencyUnit Euro where
factor _ = 1
showunit _ _ = "€"
data Dollar
instance Convertable CurrencyUnit Dollar where
factor _ = 0.7760
showunit _ _ = "$"
data Yen
instance Convertable CurrencyUnit Yen where
factor _ = 0.009399
showunit _ _ = "¥"
data Pound
instance Convertable CurrencyUnit Pound where
factor _ = 1.238
showunit _ _ = "£"
data Gulden
instance Convertable CurrencyUnit Gulden where
factor _ = 0.453780216
showunit _ _ = "ƒ"
euro :: (Fractional f) => Value f CurrencyUnit Euro
euro = one
eurocent :: (Fractional f) => Value f CurrencyUnit Euro
eurocent = mkVal 0.01
dollar :: (Fractional f) => Value f CurrencyUnit Dollar
dollar = one
dollarcent :: (Fractional f) => Value f CurrencyUnit Dollar
dollarcent = mkVal 0.01
yen :: (Fractional f) => Value f CurrencyUnit Yen
yen = one
pound :: (Fractional f) => Value f CurrencyUnit Pound
pound = one
gulden :: (Fractional f) => Value f CurrencyUnit Gulden
gulden = one