currency-0.2.0.0: Types representing standard and non-standard currencies

Safe HaskellSafe-Inferred

Currency.Rates

Synopsis

Documentation

data Rates a b Source

A map from currency to exchange rate against some reference currency

Constructors

Rates 

Fields

reference :: a
 
rates :: Map a b
 

Instances

(Eq a, Eq b) => Eq (Rates a b) 
(Ord a, Read a, Read b) => Read (Rates a b) 
(Show a, Show b) => Show (Rates a b) 

rebase :: (Ord a, Fractional b) => a -> Rates a b -> Rates a bSource

Change the reference currency to a different one found in the Map

exchangeRateSource

Arguments

:: (Ord a, Fractional b) 
=> Rates a b 
-> a

Source currency

-> a

Target currency

-> Maybe b 

Convenience function for getting a single exchange rate

If you're doing a lot of conversions, use rebase and lookup