@@ -4,11 +4,16 @@ module Data.Finance.Money
44 ) where
55
66import Data.Finance.Currency (kind Currency, class Currency, CProxy(..), decimals)
7+import Data.Generic (class Generic)
8+import Prelude
79
810-- | An amount of money in the smallest discrete unit of a particular currency.
911-- | For example, `256 :: Discrete GBP` would represent £2.56, whereas
1012-- | `256 :: Discrete JPY` would represent ¥256.
1113newtype Discrete (c :: Currency) = Discrete Int
14+derive newtype instance eqDiscrete :: Eq (Discrete c)
15+derive newtype instance ordDiscrete :: Ord (Discrete c)
16+derive instance genericDiscrete :: Generic (Discrete c)
1217
1318showDiscrete :: ∀ c. (Currency c) => Discrete c -> String
1419showDiscrete (Discrete n) = showDiscrete' n (decimals (CProxy :: CProxy c))