Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type M r m = ContT r (RWST () () (Map KeyIx (Aged Entry)) m)
- data Aged a = Aged {}
- data Age
- type Key = ([(CommoditySymbol, Quantity)], AccountName, Day)
- type KeyIx = (Key, Int)
- addNewEntriesToJournal :: (MonadIO m, MonadReader (Options user Config env) m) => [FilledEntry] -> Journal -> m [Entry]
- deriveKey :: Transaction -> Key
- loop :: (MonadIO m, MonadReader (Options user Config env) m) => (() -> M r m ()) -> Int -> Int -> FilledEntry -> M r m ()
- eitherToMaybe :: Either b a -> Maybe a
- findDuplicates :: Monad m => Key -> M r m [(KeyIx, Aged Entry)]
- findFuzzy :: Monad m => Transaction -> M r m [(KeyIx, Aged Entry)]
- checkOrAsk :: (MonadIO m, MonadReader (Options user Config env) m) => (() -> M r m ()) -> FilledEntry -> Text -> [((KeyIx, Aged Entry), Maybe Int)] -> M r m ()
- prettyPrint :: Maybe Int -> FilledEntry -> Aged Entry -> Text -> Int -> Text
- applyChanges :: ImportTag -> FilledEntry -> Key -> Key -> Aged Entry -> Aged Entry
Documentation
type Key = ([(CommoditySymbol, Quantity)], AccountName, Day) Source #
the key that is used to compare transactions. The Int is a counter, to ensure there are no actual duplicates in the map and to be able to update entries.
Duplicates are then found by extraction of a key range using
split
. See findDuplicates
.
addNewEntriesToJournal Source #
:: (MonadIO m, MonadReader (Options user Config env) m) | |
=> [FilledEntry] | new candidates including entries already existing in journal possible duplicates |
-> Journal | |
-> m [Entry] |
Takes a list of new entries, removes duplicates or updates existing transactions and adds new entries.
deriveKey :: Transaction -> Key Source #
Derive a key from a transaction and an index
loop :: (MonadIO m, MonadReader (Options user Config env) m) => (() -> M r m ()) -> Int -> Int -> FilledEntry -> M r m () Source #
loop through all existing possible duplicates of a new transaction
eitherToMaybe :: Either b a -> Maybe a Source #
findDuplicates :: Monad m => Key -> M r m [(KeyIx, Aged Entry)] Source #
Find all duplicates for a given key
:: (MonadIO m, MonadReader (Options user Config env) m) | |
=> (() -> M r m ()) | |
-> FilledEntry | |
-> Text | message |
-> [((KeyIx, Aged Entry), Maybe Int)] | |
-> M r m () |
check single new entry against a list of conflict candidates, and insert new entry (if list is empty), or keep old entry (if identical to new one), or ask weither to modify old entry or insert new entry.