fix build warnings in hledger-lib

This commit is contained in:
Simon Michael 2012-05-06 20:42:34 +00:00
parent 68966fe43b
commit 2f28931d83
2 changed files with 24 additions and 24 deletions

View File

@ -165,18 +165,18 @@ maybePeriod :: Day -> String -> Maybe (Interval,DateSpan)
maybePeriod refdate = either (const Nothing) Just . parsePeriodExpr refdate maybePeriod refdate = either (const Nothing) Just . parsePeriodExpr refdate
-- | Show a DateSpan as a human-readable pseudo-period-expression string. -- | Show a DateSpan as a human-readable pseudo-period-expression string.
dateSpanAsText :: DateSpan -> String -- dateSpanAsText :: DateSpan -> String
dateSpanAsText (DateSpan Nothing Nothing) = "all" -- dateSpanAsText (DateSpan Nothing Nothing) = "all"
dateSpanAsText (DateSpan Nothing (Just e)) = printf "to %s" (show e) -- dateSpanAsText (DateSpan Nothing (Just e)) = printf "to %s" (show e)
dateSpanAsText (DateSpan (Just b) Nothing) = printf "from %s" (show b) -- dateSpanAsText (DateSpan (Just b) Nothing) = printf "from %s" (show b)
dateSpanAsText (DateSpan (Just b) (Just e)) = printf "%s to %s" (show b) (show e) -- dateSpanAsText (DateSpan (Just b) (Just e)) = printf "%s to %s" (show b) (show e)
-- | Convert a single smart date string to a date span using the provided -- | Convert a single smart date string to a date span using the provided
-- reference date, or raise an error. -- reference date, or raise an error.
spanFromSmartDateString :: Day -> String -> DateSpan -- spanFromSmartDateString :: Day -> String -> DateSpan
spanFromSmartDateString refdate s = spanFromSmartDate refdate sdate -- spanFromSmartDateString refdate s = spanFromSmartDate refdate sdate
where -- where
sdate = fromparse $ parsewith smartdateonly s -- sdate = fromparse $ parsewith smartdateonly s
spanFromSmartDate :: Day -> SmartDate -> DateSpan spanFromSmartDate :: Day -> SmartDate -> DateSpan
spanFromSmartDate refdate sdate = DateSpan (Just b) (Just e) spanFromSmartDate refdate sdate = DateSpan (Just b) (Just e)
@ -209,8 +209,8 @@ spanFromSmartDate refdate sdate = DateSpan (Just b) (Just e)
span (y,m,"") = (startofmonth day, nextmonth day) where day = fromGregorian (read y) (read m) 1 span (y,m,"") = (startofmonth day, nextmonth day) where day = fromGregorian (read y) (read m) 1
span (y,m,d) = (day, nextday day) where day = fromGregorian (read y) (read m) (read d) span (y,m,d) = (day, nextday day) where day = fromGregorian (read y) (read m) (read d)
showDay :: Day -> String -- showDay :: Day -> String
showDay day = printf "%04d/%02d/%02d" y m d where (y,m,d) = toGregorian day -- showDay day = printf "%04d/%02d/%02d" y m d where (y,m,d) = toGregorian day
-- | Convert a smart date string to an explicit yyyy\/mm\/dd string using -- | Convert a smart date string to an explicit yyyy\/mm\/dd string using
-- the provided reference date, or raise an error. -- the provided reference date, or raise an error.
@ -306,12 +306,12 @@ nthdayofweekcontaining n d | d1 >= d = d1
---------------------------------------------------------------------- ----------------------------------------------------------------------
-- parsing -- parsing
-- | Parse a couple of date-time string formats to a time type. -- -- | Parse a couple of date-time string formats to a time type.
parsedatetimeM :: String -> Maybe LocalTime -- parsedatetimeM :: String -> Maybe LocalTime
parsedatetimeM s = firstJust [ -- parsedatetimeM s = firstJust [
parseTime defaultTimeLocale "%Y/%m/%d %H:%M:%S" s, -- parseTime defaultTimeLocale "%Y/%m/%d %H:%M:%S" s,
parseTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" s -- parseTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" s
] -- ]
-- | Parse a couple of date string formats to a time type. -- | Parse a couple of date string formats to a time type.
parsedateM :: String -> Maybe Day parsedateM :: String -> Maybe Day
@ -320,10 +320,10 @@ parsedateM s = firstJust [
parseTime defaultTimeLocale "%Y-%m-%d" s parseTime defaultTimeLocale "%Y-%m-%d" s
] ]
-- | Parse a date-time string to a time type, or raise an error. -- -- | Parse a date-time string to a time type, or raise an error.
parsedatetime :: String -> LocalTime -- parsedatetime :: String -> LocalTime
parsedatetime s = fromMaybe (error' $ "could not parse timestamp \"" ++ s ++ "\"") -- parsedatetime s = fromMaybe (error' $ "could not parse timestamp \"" ++ s ++ "\"")
(parsedatetimeM s) -- (parsedatetimeM s)
-- | Parse a date string to a time type, or raise an error. -- | Parse a date string to a time type, or raise an error.
parsedate :: String -> Day parsedate :: String -> Day
@ -432,8 +432,8 @@ md = do
months = ["january","february","march","april","may","june", months = ["january","february","march","april","may","june",
"july","august","september","october","november","december"] "july","august","september","october","november","december"]
monthabbrevs = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"] monthabbrevs = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"]
weekdays = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"] -- weekdays = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]
weekdayabbrevs = ["mon","tue","wed","thu","fri","sat","sun"] -- weekdayabbrevs = ["mon","tue","wed","thu","fri","sat","sun"]
monthIndex s = maybe 0 (+1) $ lowercase s `elemIndex` months monthIndex s = maybe 0 (+1) $ lowercase s `elemIndex` months
monIndex s = maybe 0 (+1) $ lowercase s `elemIndex` monthabbrevs monIndex s = maybe 0 (+1) $ lowercase s `elemIndex` monthabbrevs

View File

@ -195,7 +195,7 @@ queryFromOpts opts@ReportOpts{..} d = -- strace $
++ (maybe [] ((:[]) . Depth) depth_) ++ (maybe [] ((:[]) . Depth) depth_)
,[]) ,[])
where where
(apats,dpats,mds) = parsePatternArgs patterns_ (apats,dpats,_{-* mds *-}) = parsePatternArgs patterns_
-- queryFromOpts :: ReportOpts -> Day -> (Query, [QueryOpt]) -- queryFromOpts :: ReportOpts -> Day -> (Query, [QueryOpt])
-- queryFromOpts opts d = parseQuery d (unwords $ patterns_ opts) -- queryFromOpts opts d = parseQuery d (unwords $ patterns_ opts)