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

Safe HaskellNone
LanguageHaskell2010

Buchhaltung.Common

Contents

Synopsis

CONFIGURATION

CSV PARSER

readcsv :: Char -> Text -> [[Text]] #

dbacl output parser

testdbacl :: IO () #

dbacl_parse :: [AccountName] -> String -> Either ParseError [(AccountName, String)] #

parse dbacl output (see testdbacl for the format of dbacl's output)

Utilities

idx :: (Eq a, Show a) => [a] -> a -> Int #

Dates

saveChanges #

Arguments

:: (MonadReader (Options User config env) m, MonadIO m) 
=> Maybe Journal 
-> (Journal -> (Journal, Integer))

modifier, returning number of changed

-> m Journal 

Read the journal file again, before applying Changes (to not overwrite possible changes, that were made in the mean time) saveChanges :: String -- ^ journal path -> (Journal-> (Journal, Integer)) -> IO Journal

Lenses

changeTransaction :: [(Transaction, Transaction)] -> Journal -> (Journal, Integer) #

replaces every matching transaction in the given journal counts the number of changed transactions

countUpdates :: Traversal' s a -> (a -> Maybe a) -> s -> (s, Integer) #

Update a traversal and count the number of updates

data WithSource a #

Constructors

WithSource 

Fields

Instances

Functor WithSource # 

Methods

fmap :: (a -> b) -> WithSource a -> WithSource b #

(<$) :: a -> WithSource b -> WithSource a #

extractSource :: ImportTag -> Transaction -> Either String (WithSource ()) #

extracts the source line from a Transaction

make CSV data easier to handle

stripCsv :: ([Text], [MyRecord]) -> ([Text], [MyRecord]) #

parseCsv #

Arguments

:: Char

separator

-> Text 
-> ([Text], [MyRecord]) 

Import Types

data ImportedEntry' a s #

Constructors

ImportedEntry 

Fields

  • ieT :: Transaction

    transaction without postings (they will be inserted later)

  • iePostings :: a
     
  • ieSource :: s

    source to check for duplicates and for Bayesian matching

Instances

(Show s, Show a) => Show (ImportedEntry' a s) # 

type ImportedEntry #

Arguments

 = ImportedEntry' [(AccountId, Text, Maybe Text, Bool)] Source

postings of [acount,amount]: only ImportedEntry with one posting is currently implemented in the statists functionality of Add.hs (See PROBLEM1) as well in the duplicates algorithm in addNew

genTrans :: Day -> Maybe Day -> Text -> Transaction #

helper function to create transaction for ImportedEntry

data Importer env #

Constructors

Importer 

windoof :: Maybe (Handle -> IO ()) #

parseDateM :: Monad m => String -> Text -> m Day #

type Getter a = MyRecord -> a #

retrieval function

data CsvPostingImport #

Constructors

CsvPosting 

Fields

data CsvImport env #

Constructors

CSV 

Fields

data Description env #

Constructors

Field Text 
Const Text 
Read (env -> Text) 

data CheckedCsvImport a #

Constructors

UnsafeCSV 

Fields

type VersionedCSV env #

Arguments

 = MonadError Msg m 
=> m (SFormat DefaultVersion, Map Version (CheckedCsvImport env))

(format with default version, _)

Pretty Printing

table #

Arguments

:: [Int]

max width

-> [Text]

Header

-> [[Text]]

list of cols

-> Box 

table1 #

Arguments

:: NonEmpty [Box]

list of rows

-> Box 

table2 #

Arguments

:: [Int]

max width

-> [Text]

Header

-> [[Text]]

list of cols

-> NonEmpty [Box]

list of rows

mlen :: ListLike l e => [l] -> Int #

text' :: Text -> Box #

loadJournal :: (MonadError Msg m, MonadIO m) => [Ledgers -> Maybe FilePath] -> Options User config env -> m Journal #

textstrip :: Text -> Text #

Remove leading and trailing whitespace.