From c537f9426b734945195884cfb2cc0c25862db769 Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Tue, 27 Jul 2021 21:53:20 +1000 Subject: [PATCH] dev: lens: Use lenses for updateReportSpec(With). --- hledger-lib/Hledger/Reports/ReportOptions.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Reports/ReportOptions.hs b/hledger-lib/Hledger/Reports/ReportOptions.hs index 1abcb51a6..fb85fbf44 100644 --- a/hledger-lib/Hledger/Reports/ReportOptions.hs +++ b/hledger-lib/Hledger/Reports/ReportOptions.hs @@ -285,11 +285,11 @@ reportOptsToSpec day ropts = do -- unparseable options data. This is the safe way to change a ReportSpec, -- ensuring that all fields (_rsQuery, _rsReportOpts, querystring_, etc.) are in sync. updateReportSpec :: ReportOpts -> ReportSpec -> Either String ReportSpec -updateReportSpec ropts rspec = reportOptsToSpec (_rsDay rspec) ropts +updateReportSpec = setWithReport reportOpts -- | Like updateReportSpec, but takes a ReportOpts-modifying function. updateReportSpecWith :: (ReportOpts -> ReportOpts) -> ReportSpec -> Either String ReportSpec -updateReportSpecWith f rspec = reportOptsToSpec (_rsDay rspec) . f $ _rsReportOpts rspec +updateReportSpecWith = overWithReport reportOpts -- | Generate a ReportSpec from RawOpts and the current date. rawOptsToReportSpec :: RawOpts -> IO ReportSpec