Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 920 Bytes

README.md

File metadata and controls

25 lines (18 loc) · 920 Bytes

safe-money

This is an experimental Haskell library that explores creating a safe type for representing monetary amounts.

I set up the following requirements:

  1. The type should allow declaring the number of fractional digits.
  2. The type should allow declaring the amount's currency and prevent operations on monetary amounts of differring currencies.
  3. Currency should only allow valid currencies.

Unsolved problems

-- Can I do not forgetful currency to witness cast?
currencyToWitness :: (c :: Currency) -> CurrencyWitness c
-- The above doesn't work, because (c :: Currency) says that currencyToWitness
-- accepts a paramater of type c, which is a value (of type Currency), so it
-- doesn't work.

See also