Module
Data.Finance.Money
- Package
- purescript-money
- Repository
- TinkerTravel/purescript-money
#Discrete Source
newtype Discrete (c :: Currency)
An amount of money in the smallest discrete unit of a particular currency.
For example, wrap 256 :: Discrete GBP
would represent £2.56, whereas
wrap 256 :: Discrete JPY
would represent ¥256. If you want to work with
higher granularity, you can define your own currency type.
Constructors
Instances
#formatDiscrete Source
formatDiscrete :: forall c. Currency c => Format -> Discrete c -> String
Apply a format to a discrete amount.
#showDiscrete Source
showDiscrete :: forall c. Currency c => Discrete c -> String
DEPRECATED: use formatDiscrete
instead.
Show the discrete value with the correct number of decimals. Will not prepend the currency sign. Negative amounts are prefixed with a hyphen-minus.
Examples:
showDiscrete (Discrete 256 :: Discrete GBP) == "2.56"
showDiscrete (Discrete (-256) :: Discrete GBP) == "-2.56"