buchhaltung-0.0.7: Automates most of your plain text accounting data entry in ledger format.

Safe HaskellNone
LanguageHaskell2010

Buchhaltung.Uniques

Synopsis

Documentation

type M r m = ContT r (RWST () () (Map KeyIx (Aged Entry)) m) Source #

The monad stack

data Aged a Source #

Constructors

Aged 

Fields

Instances

Show a => Show (Aged a) Source # 

Methods

showsPrec :: Int -> Aged a -> ShowS #

show :: Aged a -> String #

showList :: [Aged a] -> ShowS #

data Age Source #

Constructors

Old 
New 

Instances

Eq Age Source # 

Methods

(==) :: Age -> Age -> Bool #

(/=) :: Age -> Age -> Bool #

Show Age Source # 

Methods

showsPrec :: Int -> Age -> ShowS #

show :: Age -> String #

showList :: [Age] -> ShowS #

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.

type KeyIx = (Key, Int) Source #

addNewEntriesToJournal Source #

Arguments

:: (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

findDuplicates :: Monad m => Key -> M r m [(KeyIx, Aged Entry)] Source #

Find all duplicates for a given key

checkOrAsk Source #

Arguments

:: (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.

prettyPrint Source #

Arguments

:: Maybe Int 
-> FilledEntry 
-> Aged Entry 
-> Text

Message

-> Int

Remaining

-> Text 

applyChanges Source #

Arguments

:: ImportTag 
-> FilledEntry 
-> Key

new key

-> Key

old key

-> Aged Entry 
-> Aged Entry