A currency code is (typically) defined as all-uppercase, three-letter
string. In this library, we are particularly using the regular expression
REGEXP_CURRENCY_CODE which allows any uppercase letter followed by
uppercase or lowercase letters.
As for the type definition: We are using a (not-so-elegant) trick called
"tagged-type" to annotate the plain-vanilla string type to be the
CurrencyCode (poor man's newtype). Note that during the runtime, all
CurrencyCode values are simply a string values.
Type definition for currency code values.
A currency code is (typically) defined as all-uppercase, three-letter
string
. In this library, we are particularly using the regular expression REGEXP_CURRENCY_CODE which allows any uppercase letter followed by uppercase or lowercase letters.As for the type definition: We are using a (not-so-elegant) trick called "tagged-type" to annotate the plain-vanilla
string
type to be theCurrencyCode
(poor man's newtype). Note that during the runtime, allCurrencyCode
values are simply astring
values.