From 4a3e4b1725237065e0b3f14a38d3d367688ab980 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 22 Mar 2017 15:16:36 +0000 Subject: [PATCH] addons: fix warnings --- bin/hledger-chart.hs | 31 ++++++++++++++----------------- bin/hledger-check-dates.hs | 5 +++-- bin/hledger-dupes.hs | 6 +++--- bin/hledger-prices.hs | 1 + bin/hledger-print-unique.hs | 3 ++- bin/hledger-register-match.hs | 5 +++-- bin/hledger-rewrite.hs | 1 + 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/bin/hledger-chart.hs b/bin/hledger-chart.hs index f653e6141..8e8a76f6b 100755 --- a/bin/hledger-chart.hs +++ b/bin/hledger-chart.hs @@ -11,12 +11,13 @@ --package safe -} +{-# OPTIONS_GHC -Wno-missing-signatures -Wno-unused-do-bind #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} import Control.Monad import Data.Colour -import Data.Colour.Names +import Data.Colour.Names hiding (red,green) import Data.Colour.RGBSpace import Data.Colour.RGBSpace.HSL (hsl) import Data.Colour.SRGB.Linear (rgb) @@ -26,17 +27,13 @@ import Data.Maybe import Data.Ord import Data.String.Here import qualified Data.Text as T -import Data.Tree import Graphics.Rendering.Chart import Graphics.Rendering.Chart.Backend.Diagrams import Safe -import System.Console.CmdArgs hiding (def) import System.Console.CmdArgs.Explicit import System.Exit -import Text.Printf -import Hledger -import Hledger.Cli hiding (progname,progversion) +import Hledger.Cli hiding (num,green,is,balance) defchartoutput = "hledger.svg" defchartitems = 10 @@ -104,7 +101,7 @@ withJournalAndChartOptsDo opts cmd = do -- | Generate an image with the pie chart and write it to a file writeChart :: BalanceReport -> ChartOpts -> Journal -> IO () writeChart balreport opts j = do - d <- getCurrentDay +-- d <- getCurrentDay if null $ jtxns j then putStrLn "This journal has no transactions, can't make a chart." >> exitFailure else do @@ -114,19 +111,19 @@ writeChart balreport opts j = do return () where filename = chart_output_ opts - (w,h) = parseSize $ chart_size_ opts - ropts = reportopts_ $ cliopts_ opts +-- (w,h) = parseSize $ chart_size_ opts +-- ropts = reportopts_ $ cliopts_ opts -- | Parse image size from a command-line option -parseSize :: String -> (Int,Int) -parseSize str = (read w, read h) - where - x = fromMaybe (error' "Size should be in WIDTHxHEIGHT format") $ findIndex (=='x') str - (w,_:h) = splitAt x str +-- parseSize :: String -> (Int,Int) +-- parseSize str = (read w, read h) +-- where +-- x = fromMaybe (error' "Size should be in WIDTHxHEIGHT format") $ findIndex (=='x') str +-- (w,_:h) = splitAt x str -- | Generate pie chart genPie :: ChartOpts -> BalanceReport -> PieLayout -genPie opts (items, total) = def { _pie_background = solidFillStyle $ opaque $ white +genPie opts (items, _total) = def { _pie_background = solidFillStyle $ opaque $ white , _pie_plot = pie_chart } where pie_chart = def { _pie_data = map (uncurry accountPieItem) chartitems @@ -142,8 +139,8 @@ genPie opts (items, total) = def { _pie_background = solidFillStyle $ opaque $ w other = ("other", sum $ map snd rest) num = chart_items_ opts hue = if sign > 0 then red else green where (red, green) = (0, 110) - copts = cliopts_ opts - ropts = reportopts_ copts +-- copts = cliopts_ opts +-- ropts = reportopts_ copts -- | Select the nonzero items with same sign as the first, and make -- them positive. Also return a 1 or -1 corresponding to the original sign. diff --git a/bin/hledger-check-dates.hs b/bin/hledger-check-dates.hs index 3967f0976..3d01f25bc 100755 --- a/bin/hledger-check-dates.hs +++ b/bin/hledger-check-dates.hs @@ -5,6 +5,7 @@ --package here -} +{-# OPTIONS_GHC -Wno-missing-signatures -Wno-name-shadowing #-} {-# LANGUAGE QuasiQuotes #-} import Data.String.Here @@ -32,13 +33,13 @@ main :: IO () main = do opts <- getHledgerCliOpts cmdmode withJournalDo opts $ - \CliOpts{rawopts_=opts,reportopts_=ropts} j -> do + \CliOpts{rawopts_=rawopts,reportopts_=ropts} j -> do d <- getCurrentDay let ropts_ = ropts{accountlistmode_=ALFlat} let q = queryFromOpts d ropts_ let ts = filter (q `matchesTransaction`) $ jtxns $ journalSelectingAmountFromOpts ropts j - let strict = boolopt "strict" opts + let strict = boolopt "strict" rawopts let date = transactionDateFn ropts let compare a b = if strict diff --git a/bin/hledger-dupes.hs b/bin/hledger-dupes.hs index d8afac29d..4f9193405 100755 --- a/bin/hledger-dupes.hs +++ b/bin/hledger-dupes.hs @@ -6,13 +6,13 @@ --package text -} +{-# OPTIONS_GHC -Wno-missing-signatures -Wno-name-shadowing #-} {-# LANGUAGE QuasiQuotes #-} import Hledger import Hledger.Cli import Text.Printf (printf) -import System.Environment (getArgs) -import Safe (headDef) +-- import System.Environment (getArgs) import Data.List import Data.Function import Data.String.Here @@ -36,7 +36,7 @@ http://stefanorodighiero.net/software/hledger-dupes.html main = do opts <- getHledgerCliOpts cmdmode - withJournalDo opts $ \CliOpts{rawopts_=opts,reportopts_=ropts} j -> do + withJournalDo opts $ \CliOpts{rawopts_=_opts,reportopts_=_ropts} j -> do mapM_ render $ dupes $ accountsNames j accountsNames :: Journal -> [(String, AccountName)] diff --git a/bin/hledger-prices.hs b/bin/hledger-prices.hs index dbabfaacc..4c80de7ad 100755 --- a/bin/hledger-prices.hs +++ b/bin/hledger-prices.hs @@ -4,6 +4,7 @@ --package here -} +{-# OPTIONS_GHC -Wno-missing-signatures #-} {-# LANGUAGE QuasiQuotes #-} import Data.Maybe diff --git a/bin/hledger-print-unique.hs b/bin/hledger-print-unique.hs index 61dd5cdae..26c9631d4 100755 --- a/bin/hledger-print-unique.hs +++ b/bin/hledger-print-unique.hs @@ -5,7 +5,8 @@ --package here -} -{-# LANGUAGE QuasiQuotes #-} + {-# OPTIONS_GHC -Wno-missing-signatures -Wno-name-shadowing #-} + {-# LANGUAGE QuasiQuotes #-} import Data.List import Data.Ord diff --git a/bin/hledger-register-match.hs b/bin/hledger-register-match.hs index 31d2320ab..e9a585593 100755 --- a/bin/hledger-register-match.hs +++ b/bin/hledger-register-match.hs @@ -6,6 +6,7 @@ --package text -} +{-# OPTIONS_GHC -Wno-missing-signatures -Wno-name-shadowing #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} @@ -13,8 +14,8 @@ import Data.Char (toUpper) import Data.List import Data.String.Here import qualified Data.Text as T -import System.Console.CmdArgs -import System.Console.CmdArgs.Explicit +-- import System.Console.CmdArgs +-- import System.Console.CmdArgs.Explicit import Hledger import Hledger.Cli.CliOptions diff --git a/bin/hledger-rewrite.hs b/bin/hledger-rewrite.hs index eebc05bbe..08a883694 100755 --- a/bin/hledger-rewrite.hs +++ b/bin/hledger-rewrite.hs @@ -8,6 +8,7 @@ --package Diff -} +{-# OPTIONS_GHC -Wno-missing-signatures -Wno-name-shadowing #-} {-# LANGUAGE OverloadedStrings, LambdaCase, DeriveTraversable, ViewPatterns, QuasiQuotes #-} import Control.Monad.Writer