Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides base data definitions and functions for Haspara
library.
Synopsis
- data Currency
- currencyCode :: Currency -> Text
- currency :: MonadError String m => Text -> m Currency
- currencyFail :: MonadFail m => Text -> m Currency
- data CurrencyPair
- toTuple :: CurrencyPair -> (Currency, Currency)
- baseCurrency :: CurrencyPair -> Currency
- quoteCurrency :: CurrencyPair -> Currency
- currencyPair :: MonadError String m => Currency -> Currency -> m CurrencyPair
- currencyPairFail :: MonadFail m => Currency -> Currency -> m CurrencyPair
Currency
Data Definition
Type encoding for currencies.
Instances
Eq Currency Source # | |
Ord Currency Source # | |
Defined in Haspara.Internal.Currency | |
Show Currency Source # |
|
IsString Currency Source # |
|
Defined in Haspara.Internal.Currency fromString :: String -> Currency # | |
Hashable Currency Source # | |
Defined in Haspara.Internal.Currency | |
ToJSON Currency Source # |
|
Defined in Haspara.Internal.Currency | |
FromJSON Currency Source # |
|
Lift Currency Source # | |
currencyCode :: Currency -> Text Source #
Constructors
currency :: MonadError String m => Text -> m Currency Source #
Smart constructor for Currency
values within MonadError
context.
>>>
currency "" :: Either String Currency
Left "Currency code error! Expecting at least 3 uppercase characters, but received: \"\"">>>
currency " " :: Either String Currency
Left "Currency code error! Expecting at least 3 uppercase characters, but received: \" \"">>>
currency "AB" :: Either String Currency
Left "Currency code error! Expecting at least 3 uppercase characters, but received: \"AB\"">>>
currency " ABC " :: Either String Currency
Left "Currency code error! Expecting at least 3 uppercase characters, but received: \" ABC \"">>>
currency "ABC" :: Either String Currency
Right ABC
Currency Pair
Data Definition
data CurrencyPair Source #
Instances
baseCurrency :: CurrencyPair -> Currency Source #
quoteCurrency :: CurrencyPair -> Currency Source #
Constructors
currencyPair :: MonadError String m => Currency -> Currency -> m CurrencyPair Source #
currencyPairFail :: MonadFail m => Currency -> Currency -> m CurrencyPair Source #