fix: Clean up build failures due to redundant imports and duplicate
function.
This commit is contained in:
		
							parent
							
								
									603b2e9f09
								
							
						
					
					
						commit
						31c7c5d1ca
					
				| @ -202,8 +202,8 @@ readJournalFiles' = orDieTrying . readJournalFiles definputopts | |||||||
| --- ** utilities | --- ** utilities | ||||||
| 
 | 
 | ||||||
| -- | Extract ExceptT to the IO monad, failing with an error message if necessary. | -- | Extract ExceptT to the IO monad, failing with an error message if necessary. | ||||||
| orDieTrying :: ExceptT String IO a -> IO a | orDieTrying :: MonadIO m => ExceptT String m a -> m a | ||||||
| orDieTrying a = either fail return =<< runExceptT a | orDieTrying a = either (liftIO . fail) return =<< runExceptT a | ||||||
| 
 | 
 | ||||||
| -- | If the specified journal file does not exist (and is not "-"), | -- | If the specified journal file does not exist (and is not "-"), | ||||||
| -- give a helpful error and quit. | -- give a helpful error and quit. | ||||||
|  | |||||||
| @ -12,7 +12,6 @@ module Hledger.Cli.Commands.Diff ( | |||||||
|  ,diff |  ,diff | ||||||
| ) where | ) where | ||||||
| 
 | 
 | ||||||
| import Control.Monad.Except (runExceptT) |  | ||||||
| import Data.List.Extra ((\\), groupSortOn, nubBy, sortBy) | import Data.List.Extra ((\\), groupSortOn, nubBy, sortBy) | ||||||
| import Data.Function (on) | import Data.Function (on) | ||||||
| import Data.Ord (comparing) | import Data.Ord (comparing) | ||||||
| @ -20,6 +19,7 @@ import Data.Maybe (fromJust) | |||||||
| import Data.Time (diffDays) | import Data.Time (diffDays) | ||||||
| import Data.Either (partitionEithers) | import Data.Either (partitionEithers) | ||||||
| import qualified Data.Text.IO as T | import qualified Data.Text.IO as T | ||||||
|  | import Lens.Micro (set) | ||||||
| import System.Exit (exitFailure) | import System.Exit (exitFailure) | ||||||
| 
 | 
 | ||||||
| import Hledger | import Hledger | ||||||
| @ -81,11 +81,6 @@ matching ppl ppr = do | |||||||
|     (left, right) <- combinedBinBy ppamountqty (ppl, ppr) -- TODO: probably not a correct choice of bins |     (left, right) <- combinedBinBy ppamountqty (ppl, ppr) -- TODO: probably not a correct choice of bins | ||||||
|     greedyMaxMatching $ sortBy (comparing dateCloseness) [ (l,r) | l <- left, r <- right ] |     greedyMaxMatching $ sortBy (comparing dateCloseness) [ (l,r) | l <- left, r <- right ] | ||||||
| 
 | 
 | ||||||
| readJournalFile' :: FilePath -> IO Journal |  | ||||||
| readJournalFile' fn = |  | ||||||
|     runExceptT (readJournalFile definputopts{balancingopts_=defbalancingopts{ignore_assertions_=True}} fn) |  | ||||||
|     >>= either error' return  -- PARTIAL: |  | ||||||
| 
 |  | ||||||
| matchingPostings :: AccountName -> Journal -> [PostingWithPath] | matchingPostings :: AccountName -> Journal -> [PostingWithPath] | ||||||
| matchingPostings acct j = filter ((== acct) . paccount . ppposting) $ allPostingsWithPath j | matchingPostings acct j = filter ((== acct) . paccount . ppposting) $ allPostingsWithPath j | ||||||
| 
 | 
 | ||||||
| @ -100,8 +95,8 @@ unmatchedtxns s pp m = | |||||||
| -- | The diff command. | -- | The diff command. | ||||||
| diff :: CliOpts -> Journal -> IO () | diff :: CliOpts -> Journal -> IO () | ||||||
| diff CliOpts{file_=[f1, f2], reportspec_=ReportSpec{_rsQuery=Acct acctRe}} _ = do | diff CliOpts{file_=[f1, f2], reportspec_=ReportSpec{_rsQuery=Acct acctRe}} _ = do | ||||||
|   j1 <- readJournalFile' f1 |   j1 <- orDieTrying $ readJournalFile (set ignore_assertions True definputopts) f1 | ||||||
|   j2 <- readJournalFile' f2 |   j2 <- orDieTrying $ readJournalFile (set ignore_assertions True definputopts) f2 | ||||||
| 
 | 
 | ||||||
|   let acct = reString acctRe |   let acct = reString acctRe | ||||||
|   let pp1 = matchingPostings acct j1 |   let pp1 = matchingPostings acct j1 | ||||||
|  | |||||||
| @ -8,7 +8,6 @@ module Hledger.Cli.Commands.Import ( | |||||||
| where | where | ||||||
| 
 | 
 | ||||||
| import Control.Monad | import Control.Monad | ||||||
| import Control.Monad.Except (runExceptT) |  | ||||||
| import Data.List | import Data.List | ||||||
| import qualified Data.Text.IO as T | import qualified Data.Text.IO as T | ||||||
| import Hledger | import Hledger | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ module Hledger.Cli.Utils | |||||||
| where | where | ||||||
| 
 | 
 | ||||||
| import Control.Exception as C | import Control.Exception as C | ||||||
| import Control.Monad.Except (ExceptT, runExceptT, liftIO) | import Control.Monad.Except (ExceptT, liftIO) | ||||||
| 
 | 
 | ||||||
| import Data.List | import Data.List | ||||||
| import Data.Maybe | import Data.Maybe | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user