MyNixOS website logo
Description

A Haskell client for http://fixer.io/

Please see the README on Github at https://github.com/NorfairKing/fixer#readme

Fixer, a Haskell client for http://fixer.io/

Automatic Transparent Caching

Because historical currency conversion rates do not change post-hoc, we can cache them indefinitely. Because of this, and because http://fixer.io/ is a free service, we should cache the results of the API as much as possible. This client automatically transparenly caches results so that the real API is only called when absolutely necessary.

Example usage:

main :: IO
main = do
    rates <-
        autoRunFixerClient $
          withFileCache "/tmp/fixer.cache" $
            getAtDate (fromGregorian 2018 01 19) (Just EUR) Nothing
    case rates of
        Left err -> die $ show err
        Right v -> print v
Rates
  { ratesBase = EUR
  , ratesDate = 2018-01-19
  , ratesRates = fromList
    [ (AUD,Rate {unRate = 6891408149802333 % 4503599627370496})
    , (BGN,Rate {unRate = 550508759450701 % 281474976710656})
    , (BRL,Rate {unRate = 8852275427559447 % 2251799813685248})
    , (CAD,Rate {unRate = 3433093995944529 % 2251799813685248})
    , (CHF,Rate {unRate = 5295332441862229 % 4503599627370496})
    , (CNY,Rate {unRate = 8836175058891597 % 1125899906842624})
    , (CZK,Rate {unRate = 3579376541341057 % 140737488355328})
    , (DKK,Rate {unRate = 8382775166406073 % 1125899906842624})
    , (GBP,Rate {unRate = 3979605810725939 % 4503599627370496})
    , (HKD,Rate {unRate = 5393848683710959 % 562949953421312})
    , (HRK,Rate {unRate = 4185645493678139 % 562949953421312})
    , (HUF,Rate {unRate = 5439503924933427 % 17592186044416})
    , (IDR,Rate {unRate = 16316 % 1})
    , (ILS,Rate {unRate = 2355213720128743 % 562949953421312})
    , (INR,Rate {unRate = 2752790087858127 % 35184372088832})
    , (JPY,Rate {unRate = 4768889792920289 % 35184372088832})
    , (KRW,Rate {unRate = 2873903492680909 % 2199023255552})
    , (MXN,Rate {unRate = 6422133068630327 % 281474976710656})
    , (MYR,Rate {unRate = 5433592950422503 % 1125899906842624})
    , (NOK,Rate {unRate = 5417999236712733 % 562949953421312})
    , (NZD,Rate {unRate = 3790004266413641 % 2251799813685248})
    , (PHP,Rate {unRate = 8745146051423371 % 140737488355328})
    , (PLN,Rate {unRate = 2348402025692345 % 562949953421312})
    , (RON,Rate {unRate = 2623009012971261 % 562949953421312})
    , (RUB,Rate {unRate = 609850721415725 % 8796093022208})
    , (SEK,Rate {unRate = 5535655776977787 % 562949953421312})
    , (SGD,Rate {unRate = 1821480869289997 % 1125899906842624})
    , (THB,Rate {unRate = 2749236466277155 % 70368744177664})
    , (TRY,Rate {unRate = 5241852196287205 % 1125899906842624})
    , (USD,Rate {unRate = 5519161343342543 % 4503599627370496})
    , (ZAR,Rate {unRate = 8418916553415721 % 562949953421312})
    ]
  }
Metadata

Version

0.0.0.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows