hledger-lib 0.24 → 0.24.1
raw patch · 9 files changed
+26/−20 lines, 9 filesdep ~utf8-stringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: utf8-string
API changes (from Hackage documentation)
- Hledger.Data.Amount: hrs :: DecimalRaw Integer -> Amount
+ Hledger.Data.Amount: hrs :: Quantity -> Amount
Files
- CHANGES +6/−1
- Hledger/Data/Amount.hs +1/−1
- Hledger/Data/Dates.hs +1/−1
- Hledger/Data/Journal.hs +4/−5
- Hledger/Data/OutputFormat.hs +2/−1
- Hledger/Data/Transaction.hs +2/−2
- Hledger/Read/CsvReader.hs +2/−2
- Hledger/Read/JournalReader.hs +6/−5
- hledger-lib.cabal +2/−2
CHANGES view
@@ -1,6 +1,11 @@ API-ish changes in hledger-lib. For user-visible changes, see hledger. -0.24 (unreleased)+0.24.1 (2015/3/15)++- fix JournalReader "ctx" compilation warning+- add some type signatures in Utils to help make ghci-web++0.24 (2014/12/25) - fix combineJournalUpdates folding order - fix a regexReplaceCI bug
Hledger/Data/Amount.hs view
@@ -154,10 +154,10 @@ roundTo = flip const #endif num n = amount{acommodity="", aquantity=n}+hrs n = amount{acommodity="h", aquantity=n, astyle=amountstyle{asprecision=2, ascommodityside=R}} usd n = amount{acommodity="$", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}} eur n = amount{acommodity="€", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}} gbp n = amount{acommodity="£", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}}-hrs n = amount{acommodity="h", aquantity=roundTo 1 n, astyle=amountstyle{asprecision=1, ascommodityside=R}} amt `at` priceamt = amt{aprice=UnitPrice priceamt} amt @@ priceamt = amt{aprice=TotalPrice priceamt}
Hledger/Data/Dates.hs view
@@ -114,7 +114,7 @@ -- _ | let ((fy,fw,fd), (ty,tw,td)) = (toWeekDate from, toWeekDate to) in fy==ty && fw+1==tw && fd==1 && td==1 -- -> formatTime defaultTimeLocale "%0f%gw%V" from -- YYYY/MM/DDwN ("week N, starting on YYYY/MM/DD")- _ | let ((fy,fw,fd), (ty,tw,td)) = (toWeekDate from, toWeekDate to) in fy==ty && fw+1==tw && fd==1 && td==1+ _ | let ((fy,fw,fd), (ty,tw,td)) = (toWeekDate from, toWeekDate (addDays (-1) to)) in fy==ty && fw==tw && fd==1 && td==7 -> formatTime defaultTimeLocale "%0C%y/%m/%dw%V" from -- a day, YYYY/MM/DDd (d suffix is to distinguish from a regular date in register) ((fy,fm,fd), (ty,tm,td)) | fy==ty && fm==tm && fd+1==td -> formatTime defaultTimeLocale "%0C%y/%m/%dd" from
Hledger/Data/Journal.hs view
@@ -446,10 +446,9 @@ checkBalanceAssertion (errs,startbal) ps | null ps = (errs,startbal) | isNothing assertion = (errs,startbal)- |- -- bal' /= assertedbal -- MixedAmount's Eq instance currently gets confused by different precisions- not $ isReallyZeroMixedAmount (bal - assertedbal) = (errs++[err], bal)- | otherwise = (errs,bal)+ | -- bal' /= assertedbal -- MixedAmount's Eq instance currently gets confused by different precisions+ not $ isReallyZeroMixedAmount (bal - assertedbal) = (errs++[err], fullbal)+ | otherwise = (errs,fullbal) where p = last ps assertion = pbalanceassertion p@@ -473,7 +472,7 @@ -- assertion are discarded. splitAssertions :: [Posting] -> [[Posting]] splitAssertions ps- | null rest = [[]]+ | null rest = [] | otherwise = (ps'++[head rest]):splitAssertions (tail rest) where (ps',rest) = break (isJust . pbalanceassertion) ps
Hledger/Data/OutputFormat.hs view
@@ -8,6 +8,7 @@ , tests ) where +import Control.Applicative ((<*)) import Numeric import Data.Char (isPrint) import Data.Maybe@@ -27,7 +28,7 @@ formatS = "%" ++ l ++ min' ++ max' ++ "s" parseStringFormat :: String -> Either String [OutputFormat]-parseStringFormat input = case (runParser formatsp () "(unknown)") input of+parseStringFormat input = case (runParser (formatsp <* eof) () "(unknown)") input of Left y -> Left $ show y Right x -> Right x
Hledger/Data/Transaction.hs view
@@ -122,7 +122,7 @@ "2012/05/14=2012/05/15 (code) desc ; tcomment1", " ; tcomment2", " $1.00",- " * a 2.0h",+ " * a 2.00h", " ; pcomment2", "" ]@@ -203,7 +203,7 @@ } `gives` [ " $1.00",- " * a 2.0h ; pcomment1",+ " * a 2.00h ; pcomment1", " ; pcomment2", " ; tag3: val3 " ]
Hledger/Read/CsvReader.hs view
@@ -19,7 +19,7 @@ tests_Hledger_Read_CsvReader ) where-import Control.Applicative ((<$>))+import Control.Applicative ((<$>), (<*)) import Control.Exception hiding (try) import Control.Monad import Control.Monad.Error@@ -604,7 +604,7 @@ precomment = maybe "" render $ mfieldtemplate "precomment" currency = maybe (fromMaybe "" mdefaultcurrency) render $ mfieldtemplate "currency" amountstr = (currency++) $ negateIfParenthesised $ getAmountStr rules record- amount = either amounterror (Mixed . (:[])) $ runParser (do {a <- amountp; eof; return a}) nullctx "" amountstr+ amount = either amounterror (Mixed . (:[])) $ runParser (amountp <* eof) nullctx "" amountstr amounterror err = error' $ unlines ["error: could not parse \""++amountstr++"\" as an amount" ,showRecord record
Hledger/Read/JournalReader.hs view
@@ -45,6 +45,7 @@ #endif ) where+import Control.Applicative ((<*)) import qualified Control.Exception as C import Control.Monad import Control.Monad.Error@@ -214,7 +215,7 @@ r <- liftIO $ runErrorT u case r of Left err -> return $ throwError err- Right (ju, ctx) -> return $ ErrorT $ return $ Right ju+ Right (ju, _finalparsectx) -> return $ ErrorT $ return $ Right ju journalAddFile :: (FilePath,String) -> Journal -> Journal journalAddFile f j@Journal{files=fs} = j{files=fs++[f]}@@ -541,12 +542,12 @@ -- oh boy date <- case dateValueFromTags tags of Nothing -> return Nothing- Just v -> case runParser datep ctx "" v of+ Just v -> case runParser (datep <* eof) ctx "" v of Right d -> return $ Just d Left err -> parserFail $ show err date2 <- case date2ValueFromTags tags of Nothing -> return Nothing- Just v -> case runParser datep ctx "" v of+ Just v -> case runParser (datep <* eof) ctx "" v of Right d -> return $ Just d Left err -> parserFail $ show err return posting@@ -683,7 +684,7 @@ -- | Parse an amount from a string, or get an error. amountp' :: String -> Amount amountp' s =- case runParser amountp nullctx "" s of+ case runParser (amountp <* eof) nullctx "" s of Right t -> t Left err -> error' $ show err @@ -927,7 +928,7 @@ tagsInCommentLine :: String -> [Tag] tagsInCommentLine = catMaybes . map maybetag . map strip . splitAtElement ',' where- maybetag s = case runParser tag nullctx "" s of+ maybetag s = case runParser (tag <* eof) nullctx "" s of Right t -> Just t Left _ -> Nothing
hledger-lib.cabal view
@@ -1,5 +1,5 @@ name: hledger-lib-version: 0.24+version: 0.24.1 stability: stable category: Finance, Console synopsis: Core data types, parsers and utilities for the hledger accounting tool.@@ -102,7 +102,7 @@ ,split >= 0.1 && < 0.3 ,time ,transformers >= 0.2 && < 0.5- ,utf8-string >= 0.3.5 && < 0.4+ ,utf8-string >= 0.3.5 && < 1.1 ,HUnit if impl(ghc >= 7.4) build-depends: pretty-show >= 1.6.4