module Data.Currency.Currencies
(
Currency(..)
, CurrencyType(..)
, BRL(..)
, BTC(..)
, CAD(..)
, CLP(..)
, EUR(..)
, JPY(..)
, KPW(..)
, KRW(..)
, MXN(..)
, PAB(..)
, PEN(..)
, PYG(..)
, SIM(..)
, USD(..)
) where
class (Show c, Eq c) => Currency c where
currencyType :: c -> CurrencyType
isoCode :: c -> String
isoNumericCode :: c -> String
decimalDigits :: c -> Int
symbol :: c -> String
exchangeUSD :: c -> Double
countries :: c -> [String]
data CurrencyType
= Circulating
| Local
| Supranational
| Cryptocurrency
| Fictional
deriving (Show, Read, Eq)
data BRL = BRL deriving (Show, Read, Eq)
data BTC = BTC deriving (Show, Read, Eq)
data CAD = CAD deriving (Show, Read, Eq)
data CLP = CLP deriving (Show, Read, Eq)
data EUR = EUR deriving (Show, Read, Eq)
data JPY = JPY deriving (Show, Read, Eq)
data KPW = KPW deriving (Show, Read, Eq)
data KRW = KRW deriving (Show, Read, Eq)
data MXN = MXN deriving (Show, Read, Eq)
data PAB = PAB deriving (Show, Read, Eq)
data PEN = PEN deriving (Show, Read, Eq)
data PYG = PYG deriving (Show, Read, Eq)
data SIM = SIM deriving (Show, Read, Eq)
data USD = USD deriving (Show, Read, Eq)
instance Currency BRL where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "986"
decimalDigits _ = 2
symbol _ = "$"
exchangeUSD _ = 0.32
countries _ = ["BR"]
instance Currency BTC where
currencyType _ = Cryptocurrency
isoCode = show
isoNumericCode _ = ""
decimalDigits _ = 8
symbol _ = "B"
exchangeUSD _ = 4237.88
countries _ = []
instance Currency CAD where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "124"
decimalDigits _ = 2
symbol _ = "$"
exchangeUSD _ = 0.79
countries _ = ["CA"]
instance Currency CLP where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "152"
decimalDigits _ = 0
symbol _ = "$"
exchangeUSD _ = 0.0015
countries _ = ["CL"]
instance Currency EUR where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "978"
decimalDigits _ = 2
symbol _ = "€"
exchangeUSD _ = 1.18
countries _ = ["AD", "AT", "BE", "CY", "EE", "FI", "FR", "DE", "GR"
, "GP", "IE", "IT", "LV", "LT", "LU", "MT", "MQ", "YT", "MC"
, "ME", "NL", "PT", "RE", "BL", "PM", "SM", "SK", "SI", "ES"]
instance Currency JPY where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "392"
decimalDigits _ = 0
symbol _ = "¥"
exchangeUSD _ = 0.0092
countries _ = ["JP"]
instance Currency KPW where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "408"
decimalDigits _ = 2
symbol _ = "₩"
exchangeUSD _ = 0.0077
countries _ = ["KP"]
instance Currency KRW where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "410"
decimalDigits _ = 0
symbol _ = "₩"
exchangeUSD _ = 0.000877
countries _ = ["KR"]
instance Currency MXN where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "484"
decimalDigits _ = 2
symbol _ = "$"
exchangeUSD _ = 0.06
countries _ = ["MX"]
instance Currency PAB where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "590"
decimalDigits _ = 2
symbol _ = "B"
exchangeUSD _ = 1
countries _ = ["PA"]
instance Currency PEN where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "604"
decimalDigits _ = 2
symbol _ = "S"
exchangeUSD _ = 0.31
countries _ = ["PE"]
instance Currency PYG where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "600"
decimalDigits _ = 0
symbol _ = "₲"
exchangeUSD _ = 0.000179
countries _ = ["PY"]
instance Currency SIM where
currencyType _ = Fictional
isoCode = show
isoNumericCode _ = ""
decimalDigits _ = 0
symbol _ = "S"
exchangeUSD _ = 10
countries _ = []
instance Currency USD where
currencyType _ = Circulating
isoCode = show
isoNumericCode _ = "840"
decimalDigits _ = 2
symbol _ = "$"
exchangeUSD _ = 1.0
countries _ = ["US", "AS", "BB", "BM", "IO", "VG", "BQ", "EC", "MH"
, "FM", "MP", "PW", "PA", "PR", "TL", "TC", "VI"]