From 1c6a7d8a6f9bea7068e5dedef70302e76970e509 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 20 Nov 2012 02:22:20 +0000 Subject: [PATCH] rename the commodityless amount constructor to num --- hledger-lib/Hledger/Data/Amount.hs | 4 ++-- hledger-lib/Hledger/Data/Transaction.hs | 2 +- hledger-lib/Hledger/Read/JournalReader.hs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hledger-lib/Hledger/Data/Amount.hs b/hledger-lib/Hledger/Data/Amount.hs index 67efebb94..fba79b78a 100644 --- a/hledger-lib/Hledger/Data/Amount.hs +++ b/hledger-lib/Hledger/Data/Amount.hs @@ -46,7 +46,7 @@ module Hledger.Data.Amount ( amount, nullamt, missingamt, - amt, + num, usd, eur, gbp, @@ -131,7 +131,7 @@ amount = Amount{acommodity="", aquantity=0, aprice=NoPrice, astyle=amountstyle} nullamt = amount -- handy amount constructors for tests -amt n = amount{acommodity="", aquantity=n} +num n = amount{acommodity="", aquantity=n} usd n = amount{acommodity="$", aquantity=n, astyle=amountstyle{asprecision=2}} eur n = amount{acommodity="€", aquantity=n, astyle=amountstyle{asprecision=2}} gbp n = amount{acommodity="£", aquantity=n, astyle=amountstyle{asprecision=2}} diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index e2c41e1e8..52fbd0c1c 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -444,7 +444,7 @@ tests_Hledger_Data_Transaction = TestList $ concat [ ]) (showTransaction (txnTieKnot $ Transaction (parsedate "2010/01/01") Nothing False "" "x" "" [] - [Posting False "a" (Mixed [amt 1 `at` (usd 2 `withPrecision` 0)]) "" RegularPosting [] Nothing + [Posting False "a" (Mixed [num 1 `at` (usd 2 `withPrecision` 0)]) "" RegularPosting [] Nothing ,Posting False "b" missingmixedamt "" RegularPosting [] Nothing ] "")) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index e44a1279e..63154840d 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -922,7 +922,7 @@ tests_Hledger_Read_JournalReader = TestList $ concat [ assertAmountParse parseresult amount = (either (const "parse error") showAmountDebug parseresult) ~?= (showAmountDebug amount) assertAmountParse (parseWithCtx nullctx amountp "1 @ $2") - (amt 1 `withPrecision` 0 `at` (usd 2 `withPrecision` 0)) + (num 1 `withPrecision` 0 `at` (usd 2 `withPrecision` 0)) ]]