currency-convert

Typesafe currency conversion http://tuomas56.github.io/currency-convert

Latest on Hackage:0.2.1.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Tuomas Laakkonen
Maintained by pigworts2@gmail.com

currency-convert

Property | Value ------------|---------------------- Module | Data.Currency.Convert Description | Typesafe currency coversion using exchange rates from various sources. Copyright | © Tuomas Laakkonen 2016 License | BSD3 Maintainer | pigworts2@gmail.com Stability | Experimental Portability | Non-portable (GHC extensions)

This module allows values of currency to be converted from one currency to another using exchange rates from various sources.

The basic operation for this module is as follows:

First, get a conversion function (with getDefaultConverter or getConverter):

    >>> Converter convert <- getDefaultConverter

Then, construct some value of currency using the convenience functions, and convert it using the convert function you just got:

    >>> convert (usd 100) :: EUR
    90.0 eur

The result type of convert defines what currency the value will be converted into.

Currency implements Num, Fractional and Real so the usual arithmetic operations are defined, and its value can be extracted with toRational.

comments powered byDisqus