hledger-lib 0.25 → 0.25.1
raw patch · 9 files changed
+43/−38 lines, 9 filesdep ~base-compatPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base-compat
API changes (from Hackage documentation)
- Hledger.Data.Types: tlcomment :: TimeLogEntry -> String
+ Hledger.Data.Types: tlaccount :: TimeLogEntry -> String
+ Hledger.Data.Types: tldescription :: TimeLogEntry -> String
+ Hledger.Read.JournalReader: modifiedaccountname :: Stream [Char] m Char => ParsecT [Char] JournalContext m AccountName
- Hledger.Data.Types: TimeLogEntry :: SourcePos -> TimeLogCode -> LocalTime -> String -> TimeLogEntry
+ Hledger.Data.Types: TimeLogEntry :: SourcePos -> TimeLogCode -> LocalTime -> String -> String -> TimeLogEntry
Files
- CHANGES +4/−0
- Hledger/Data/Dates.hs +3/−4
- Hledger/Data/OutputFormat.hs +2/−4
- Hledger/Data/TimeLog.hs +11/−9
- Hledger/Data/Types.hs +2/−1
- Hledger/Read/CsvReader.hs +3/−5
- Hledger/Read/JournalReader.hs +6/−7
- Hledger/Read/TimelogReader.hs +9/−5
- hledger-lib.cabal +3/−3
CHANGES view
@@ -2,6 +2,10 @@ User-visible changes appear in hledger's change log. +0.25.1 (2015/4/29)++- support/require base-compat >0.8 (#245)+ 0.25 (2015/4/7) - GHC 7.10 compatibility (#239)
Hledger/Data/Dates.hs view
@@ -64,11 +64,10 @@ ) where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative.Compat ((<*))-#endif+import Prelude ()+import Prelude.Compat import Control.Monad-import Data.List+import Data.List.Compat import Data.Maybe #if MIN_VERSION_time(1,5,0) import Data.Time.Format hiding (months)
Hledger/Data/OutputFormat.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE CPP #-} module Hledger.Data.OutputFormat ( parseStringFormat , formatsp@@ -9,10 +8,9 @@ , tests ) where +import Prelude ()+import Prelude.Compat import Numeric-#if !MIN_VERSION_base(4,8,0)-import Control.Applicative.Compat ((<*))-#endif import Data.Char (isPrint) import Data.Maybe import Test.HUnit
Hledger/Data/TimeLog.hs view
@@ -28,7 +28,7 @@ import Hledger.Data.Transaction instance Show TimeLogEntry where- show t = printf "%s %s %s" (show $ tlcode t) (show $ tldatetime t) (tlcomment t)+ show t = printf "%s %s %s %s" (show $ tlcode t) (show $ tldatetime t) (tlaccount t) (tldescription t) instance Show TimeLogCode where show SetBalance = "b"@@ -54,7 +54,7 @@ | odate > idate = entryFromTimeLogInOut i o' : timeLogEntriesToTransactions now [i',o] | otherwise = [entryFromTimeLogInOut i o] where- o = TimeLogEntry (tlsourcepos i) Out end ""+ o = TimeLogEntry (tlsourcepos i) Out end "" "" end = if itime > now then itime else now (itime,otime) = (tldatetime i,tldatetime o) (idate,odate) = (localDay itime,localDay otime)@@ -84,20 +84,22 @@ tdate2 = Nothing, tstatus = True, tcode = "",- tdescription = showtime itod ++ "-" ++ showtime otod,+ tdescription = desc, tcomment = "", ttags = [], tpostings = ps, tpreceding_comment_lines="" }- showtime = take 5 . show- acctname = tlcomment i itime = tldatetime i otime = tldatetime o itod = localTimeOfDay itime otod = localTimeOfDay otime idate = localDay itime+ desc | null (tldescription i) = showtime itod ++ "-" ++ showtime otod+ | otherwise = tldescription i+ showtime = take 5 . show hours = elapsedSeconds (toutc otime) (toutc itime) / 3600 where toutc = localTimeToUTC utc+ acctname = tlaccount i amount = Mixed [hrs hours] ps = [posting{paccount=acctname, pamount=amount, ptype=VirtualPosting, ptransaction=Just t}] @@ -122,18 +124,18 @@ assertEntriesGiveStrings name es ss = assertEqual name ss (map tdescription $ timeLogEntriesToTransactions now es) assertEntriesGiveStrings "started yesterday, split session at midnight"- [clockin (mktime yesterday "23:00:00") ""]+ [clockin (mktime yesterday "23:00:00") "" ""] ["23:00-23:59","00:00-"++nowstr] assertEntriesGiveStrings "split multi-day sessions at each midnight"- [clockin (mktime (addDays (-2) today) "23:00:00") ""]+ [clockin (mktime (addDays (-2) today) "23:00:00") "" ""] ["23:00-23:59","00:00-23:59","00:00-"++nowstr] assertEntriesGiveStrings "auto-clock-out if needed"- [clockin (mktime today "00:00:00") ""]+ [clockin (mktime today "00:00:00") "" ""] ["00:00-"++nowstr] let future = utcToLocalTime tz $ addUTCTime 100 now' futurestr = showtime future assertEntriesGiveStrings "use the clockin time for auto-clockout if it's in the future"- [clockin future ""]+ [clockin future "" ""] [printf "%s-%s" futurestr futurestr] ]
Hledger/Data/Types.hs view
@@ -155,7 +155,8 @@ tlsourcepos :: SourcePos, tlcode :: TimeLogCode, tldatetime :: LocalTime,- tlcomment :: String+ tlaccount :: String,+ tldescription :: String } deriving (Eq,Ord,Typeable,Data) data HistoricalPrice = HistoricalPrice {
Hledger/Read/CsvReader.hs view
@@ -20,15 +20,14 @@ tests_Hledger_Read_CsvReader ) where-#if !MIN_VERSION_base(4,8,0)-import Control.Applicative.Compat ((<$>), (<*))-#endif+import Prelude ()+import Prelude.Compat hiding (getContents) import Control.Exception hiding (try) import Control.Monad import Control.Monad.Except -- import Test.HUnit import Data.Char (toLower, isDigit, isSpace)-import Data.List+import Data.List.Compat import Data.Maybe import Data.Ord import Data.Time.Calendar (Day)@@ -50,7 +49,6 @@ import Text.Printf (hPrintf,printf) import Hledger.Data-import Prelude hiding (getContents) import Hledger.Utils.UTF8IOCompat (getContents) import Hledger.Utils import Hledger.Read.JournalReader (amountp)
Hledger/Read/JournalReader.hs view
@@ -30,6 +30,7 @@ datetimep, codep, accountnamep,+ modifiedaccountname, postingp, amountp, amountp',@@ -45,14 +46,13 @@ #endif ) where-#if !MIN_VERSION_base(4,8,0)-import Control.Applicative.Compat ((<*))-#endif+import Prelude ()+import Prelude.Compat hiding (readFile) import qualified Control.Exception as C-import Control.Monad-import Control.Monad.Except+import Control.Monad.Compat+import Control.Monad.Except (ExceptT(..), liftIO, runExceptT, throwError, catchError) import Data.Char (isNumber)-import Data.List+import Data.List.Compat import Data.List.Split (wordsBy) import Data.Maybe import Data.Time.Calendar@@ -69,7 +69,6 @@ import Hledger.Data import Hledger.Utils-import Prelude hiding (readFile) -- standard reader exports
Hledger/Read/TimelogReader.hs view
@@ -47,9 +47,12 @@ tests_Hledger_Read_TimelogReader ) where-import Control.Monad-import Control.Monad.Except+import Prelude ()+import Prelude.Compat+import Control.Monad (liftM)+import Control.Monad.Except (ExceptT) import Data.List (isPrefixOf, foldl')+import Data.Maybe (fromMaybe) import Test.HUnit import Text.Parsec hiding (parse) import System.FilePath@@ -58,7 +61,7 @@ -- XXX too much reuse ? import Hledger.Read.JournalReader ( directive, historicalpricedirective, defaultyeardirective, emptyorcommentlinep, datetimep,- parseJournalWith, getParentAccount+ parseJournalWith, modifiedaccountname ) import Hledger.Utils @@ -104,8 +107,9 @@ code <- oneOf "bhioO" many1 spacenonewline datetime <- datetimep- comment <- optionMaybe (many1 spacenonewline >> liftM2 (++) getParentAccount restofline)- return $ TimeLogEntry sourcepos (read [code]) datetime (maybe "" rstrip comment)+ account <- fromMaybe "" <$> optionMaybe (many1 spacenonewline >> modifiedaccountname)+ description <- fromMaybe "" <$> optionMaybe (many1 spacenonewline >> restofline)+ return $ TimeLogEntry sourcepos (read [code]) datetime account description tests_Hledger_Read_TimelogReader = TestList [ ]
hledger-lib.cabal view
@@ -1,5 +1,5 @@ name: hledger-lib-version: 0.25+version: 0.25.1 stability: stable category: Finance, Console synopsis: Core data types, parsers and utilities for the hledger accounting tool.@@ -89,7 +89,7 @@ Hledger.Utils.UTF8IOCompat build-depends: base >= 4.3 && < 5- ,base-compat >= 0.5.0+ ,base-compat >= 0.8.1 ,array ,blaze-markup >= 0.5.1 ,bytestring@@ -128,7 +128,7 @@ default-language: Haskell2010 build-depends: hledger-lib , base >= 4.3 && < 5- , base-compat >= 0.5.0+ , base-compat >= 0.8.1 , array , blaze-markup >= 0.5.1 , cmdargs