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

Safe HaskellNone
LanguageHaskell2010

Fixer.Types

Description

Types for the API

Synopsis

Documentation

newtype Rate Source #

A positive and non-0 ratio

Constructors

Rate 

Fields

Instances

Eq Rate Source # 

Methods

(==) :: Rate -> Rate -> Bool #

(/=) :: Rate -> Rate -> Bool #

Show Rate Source # 

Methods

showsPrec :: Int -> Rate -> ShowS #

show :: Rate -> String #

showList :: [Rate] -> ShowS #

Generic Rate Source # 

Associated Types

type Rep Rate :: * -> * #

Methods

from :: Rate -> Rep Rate x #

to :: Rep Rate x -> Rate #

ToJSON Rate Source # 
FromJSON Rate Source # 
Validity Rate Source #

A rate is valid if:

  • The ratio inside is valid.
  • The ratio is not zero.
  • The ratio is normalised.
type Rep Rate Source # 
type Rep Rate = D1 * (MetaData "Rate" "Fixer.Types" "fixer-0.0.0.0-KyDvPt0WkGj3Gzgyze5650" True) (C1 * (MetaCons "Rate" PrefixI True) (S1 * (MetaSel (Just Symbol "unRate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Ratio Natural))))

oneRate :: Rate Source #

The identity of mulRate

mulRate :: Rate -> Rate -> Rate Source #

Multiply two rates

divRate :: Rate -> Rate -> Rate Source #

Divide one rate by another

normaliseRate :: Rate -> Rate Source #

Ensure that a rate is internally normalised. This is a requirement for Validity

rateToRational :: Rate -> Rational Source #

Convert a rate to a 'Ratio Integer' instead of 'Ratio Natural'.

This is a lossless transformation.

rateToDouble :: Rate -> Double Source #

Convert a rate to a Double.

This may not be a lossless transformation

data Currency Source #

A sum-type of the supported currencies on fixer.io

Constructors

AUD 
BGN 
BRL 
CAD 
CHF 
CNY 
CZK 
DKK 
EUR 
GBP 
HKD 
HRK 
HUF 
IDR 
ILS 
INR 
JPY 
KRW 
MXN 
MYR 
NOK 
NZD 
PHP 
PLN 
RON 
RUB 
SEK 
SGD 
THB 
TRY 
USD 
ZAR 

Instances

Bounded Currency Source # 
Enum Currency Source # 
Eq Currency Source # 
Ord Currency Source # 
Read Currency Source # 
Show Currency Source # 
Generic Currency Source # 

Associated Types

type Rep Currency :: * -> * #

Methods

from :: Currency -> Rep Currency x #

to :: Rep Currency x -> Currency #

ToJSON Currency Source # 
ToJSONKey Currency Source # 
FromJSON Currency Source # 
FromJSONKey Currency Source # 
ToHttpApiData Currency Source # 
Validity Currency Source # 
type Rep Currency Source # 
type Rep Currency = D1 * (MetaData "Currency" "Fixer.Types" "fixer-0.0.0.0-KyDvPt0WkGj3Gzgyze5650" False) ((:+:) * ((:+:) * ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "AUD" PrefixI False) (U1 *)) (C1 * (MetaCons "BGN" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "BRL" PrefixI False) (U1 *)) (C1 * (MetaCons "CAD" PrefixI False) (U1 *)))) ((:+:) * ((:+:) * (C1 * (MetaCons "CHF" PrefixI False) (U1 *)) (C1 * (MetaCons "CNY" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "CZK" PrefixI False) (U1 *)) (C1 * (MetaCons "DKK" PrefixI False) (U1 *))))) ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "EUR" PrefixI False) (U1 *)) (C1 * (MetaCons "GBP" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "HKD" PrefixI False) (U1 *)) (C1 * (MetaCons "HRK" PrefixI False) (U1 *)))) ((:+:) * ((:+:) * (C1 * (MetaCons "HUF" PrefixI False) (U1 *)) (C1 * (MetaCons "IDR" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "ILS" PrefixI False) (U1 *)) (C1 * (MetaCons "INR" PrefixI False) (U1 *)))))) ((:+:) * ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "JPY" PrefixI False) (U1 *)) (C1 * (MetaCons "KRW" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "MXN" PrefixI False) (U1 *)) (C1 * (MetaCons "MYR" PrefixI False) (U1 *)))) ((:+:) * ((:+:) * (C1 * (MetaCons "NOK" PrefixI False) (U1 *)) (C1 * (MetaCons "NZD" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "PHP" PrefixI False) (U1 *)) (C1 * (MetaCons "PLN" PrefixI False) (U1 *))))) ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "RON" PrefixI False) (U1 *)) (C1 * (MetaCons "RUB" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "SEK" PrefixI False) (U1 *)) (C1 * (MetaCons "SGD" PrefixI False) (U1 *)))) ((:+:) * ((:+:) * (C1 * (MetaCons "THB" PrefixI False) (U1 *)) (C1 * (MetaCons "TRY" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "USD" PrefixI False) (U1 *)) (C1 * (MetaCons "ZAR" PrefixI False) (U1 *)))))))

newtype Symbols Source #

A nonempty list of Currencys

Constructors

Symbols 

data Rates Source #

The raw response of fixer.io

Constructors

Rates 

Instances