-- | Apply CoinPortion to Coin (with rounding down).
--
-- Use it for calculating coin amounts.
applyCoinPortionDown :: CoinPortion -> Coin -> Coin
applyCoinPortionDown (getCoinPortion -> p) (unsafeGetCoin -> c) =
    Coin . fromInteger $
        (toInteger p * toInteger c) `div`
        (toInteger coinPortionDenominator)
applyCoinPortionDown :: CoinPortion -> Coin -> Coin
applyCoinPortionDown (getCoinPortion -> p) (unsafeGetCoin -> c) =
    Coin . fromInteger $
        (toInteger p * toInteger c) `div`
        (toInteger coinPortionDenominator)
applyCoinPortionDown (getCoinPortion -> p) (unsafeGetCoin -> c) =
    Coin . fromInteger $
        (toInteger p * toInteger c) `div`
        (toInteger coinPortionDenominator)