importOfx
  :: Map Account (Set Text)
  -- ^
  -> (OfxIn -> Maybe OfxOut)
  -- ^
  -> OfxIn
  -- ^
  -> Maybe OfxOut
importOfx lkp f inp = do
  out <- f inp
  guard (freshPosting inp out lkp)
  return out


-- * Reading Copper data

-- | Parses existing copper files.  Takes a function that creates new
-- transactions, and returns a new function that will also reject
-- duplicates.
importOfx
  :: Map Account (Set Text)
  -- ^
  -> (OfxIn -> Maybe OfxOut)
  -- ^
  -> OfxIn
  -- ^
  -> Maybe OfxOut
importOfx lkp f inp = do
  out <- f inp
  guard (freshPosting inp out lkp)
  return out


-- * Reading Copper data

-- | Parses existing copper files.  Takes a function that creates new
-- transactions, and returns a new function that will also reject
-- duplicates.
importOfx lkp f inp = do
  out <- f inp
  guard (freshPosting inp out lkp)
  return out


-- * Reading Copper data

-- | Parses existing copper files.  Takes a function that creates new
-- transactions, and returns a new function that will also reject
-- duplicates.