By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Add lot types to the ledger Work in progress: this commit does not compile. It is committed so the work can be picked up on another machine; LOT-PRICES-HANDOVER.md section 6.4 lists the exact edits that finish it. A currency gains an optional lot, so that a lot is a distinct key in every balance map and lot balances never mix. Lot holds the acquisition rate and its currency inline rather than nesting a Currency, which makes a lot of a lot unrepresentable and, more importantly, keeps a currency location-stable: the only annotations inside it are declaration locations, so two mentions of the same lot in different places compare equal. The build breaks at the four currency-membership checks in the Ledger validity instance, which is the undefined trick and the partial application of the Currency constructor doing their job. LOT-PRICES-HANDOVER.md carries the whole design: the agreed syntax and why it beat the alternatives, the balancing and valuation rules, the phase plan with a green criterion per phase, the state of every file, and the facts about this codebase that were expensive to work out.