ofxImportWithCopperParse
  :: (OfxIn -> Maybe OfxOut)
  -- ^ Examines each OFX transaction
  -> Seq (Either Text FilePath, Text)
  -- ^ Copper files with their names
  -> Seq Text
  -- ^ OFX input files
  -> Either OfxToCopperError (WholeFile Char ())
  -- ^ If successful, returns the formatted new transactions.  Also,
  -- if there is a last Copper file, returns its filename and its
  -- parsed 'WholeFile'.
ofxImportWithCopperParse fOrig copperFiles ofxFiles = do
  fNoDupes <- Lens.over Lens._Left OTCBadCopperFile
    . parseCopperFiles fOrig $ copperFiles
  txns <- fmap join . traverse (importOfxTxns fNoDupes) $ ofxFiles
  Lens.over Lens._Left OTCCopperizationFailed
    . copperizeAndFormat $ txns


-- * Importing OFX data (without Copper data)

-- | Imports all OFX transactions.
ofxImportWithCopperParse
  :: (OfxIn -> Maybe OfxOut)
  -- ^ Examines each OFX transaction
  -> Seq (Either Text FilePath, Text)
  -- ^ Copper files with their names
  -> Seq Text
  -- ^ OFX input files
  -> Either OfxToCopperError (WholeFile Char ())
ofxImportWithCopperParse fOrig copperFiles ofxFiles = do
  fNoDupes <- Lens.over Lens._Left OTCBadCopperFile
    . parseCopperFiles fOrig $ copperFiles
  txns <- fmap join . traverse (importOfxTxns fNoDupes) $ ofxFiles
  Lens.over Lens._Left OTCCopperizationFailed
    . copperizeAndFormat $ txns


-- * Importing OFX data (without Copper data)

-- | Imports all OFX transactions.
ofxImportWithCopperParse fOrig copperFiles ofxFiles = do
  fNoDupes <- Lens.over Lens._Left OTCBadCopperFile
    . parseCopperFiles fOrig $ copperFiles
  txns <- fmap join . traverse (importOfxTxns fNoDupes) $ ofxFiles
  Lens.over Lens._Left OTCCopperizationFailed
    . copperizeAndFormat $ txns


-- * Importing OFX data (without Copper data)

-- | Imports all OFX transactions.