Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type AddT' env m = RWST (FullOptions env) () Journal (ErrorT m)
- type AddOptions = FullOptions [Partner]
- type AddT m = AddT' [Partner] m
- data Partner = Partner {
- pUser :: User
- partnerAccount :: AccountName
- userAccount :: AccountName
- partnerLedger :: FilePath
- partners :: (MonadReader AddOptions m, MonadError Msg m) => m [Partner]
- add :: AddT' [Username] IO ()
- toPartner :: Monad m => User -> AddT' env m Partner
- hello :: Monad m => AddT' env m String
- mainLoop :: AddT IO ()
- saveAndClear :: Maybe Transaction -> Bool -> (Maybe Transaction, [(Partner, Transaction)]) -> AddT IO ()
- clearSecondPosting :: Transaction -> (Transaction, Transaction)
- infoNewTx
- split :: [EditablePosting] -> ([Posting], [(Partner, E.NonEmpty Posting, MixedAmount)])
- finishTransaction :: (MonadIO m, MonadReader AddOptions m) => Bool -> Maybe (Transaction, [EditablePosting]) -> m (Maybe Transaction, [(Partner, Transaction)])
- iso8601 :: UTCTime -> String
- myJournalAddTransaction :: FilePath -> [Transaction] -> AddT IO Journal
- clearNthPosting :: Int -> Transaction -> Transaction
- data Asserted a = AA {
- aComment :: Comment
- aAssertion :: Maybe Amount
- aAmount :: a
- type AssertedAmount = Asserted MixedAmount
- fromPosting :: Posting -> Asserted MixedAmount
- showAssertedAmount :: Asserted MixedAmount -> T.Text
- sugTrans :: AddT IO (AssertedAmount, Maybe Transaction)
- data Choice
- choose :: [String] -> IO Choice
- menup :: Int -> Parser Choice
- stripP
- myEd :: EditorConf (AddT IO) EditablePosting Transaction
- mainPrompt :: (ListLike m item, IsString m) => m
- quiet :: Monad m => a -> m (Maybe a)
- clearTrans :: Zipper EditablePosting -> Zipper EditablePosting
- nextNotFirst :: EditablePosting -> EditablePosting
- balanceTransactionIfRequired :: Transaction -> Either String Transaction
- data Balancing = B {}
- balanceRequirement :: MonadError String m => [Posting] -> m Balancing
- checkDone :: LState EditablePosting Transaction -> AddT IO (Maybe (LState EditablePosting Transaction))
- askDescription :: Maybe T.Text -> IO T.Text
- askDate :: Maybe Day -> IO (Day, T.Text)
- dateandcodep :: MP.Parser (SmartDate, T.Text)
- myAskAccount
- askAmount :: Maybe AssertedAmount -> T.Text -> Maybe T.Text -> AddT IO AssertedAmount
- parseAmount :: Journal -> T.Text -> Either (ParseError Char Dec) AssertedAmount
- _amountp2
- nosymbolamountp2 :: Monad m => JournalStateParser m Amount
- getDefaultCommodityAndStyle2 :: Journal -> Maybe (CommoditySymbol, AmountStyle)
- askPercent :: IO Decimal
- data EditablePosting = EditablePosting {}
- type EditablePostings = Zipper EditablePosting
- editablePosting
- addPosting :: AccountName -> Maybe AssertedAmount -> EditablePosting -> EditablePosting
- setMissing :: EditablePosting -> EditablePosting
- removeAmount :: EditablePosting -> EditablePosting
- jumpTo :: Int -> Zipper a -> Zipper a
- editDate :: LState a Transaction -> AddT IO (LState a Transaction)
- editDescription :: LState a Transaction -> AddT IO (LState a Transaction)
- editCurAmount :: EditablePostings -> AddT IO EditablePostings
- modifyCurAmount :: (AssertedAmount -> AssertedAmount -> AssertedAmount) -> Bool -> EditablePostings -> AddT IO EditablePostings
- replaceMissing :: MixedAmount -> MixedAmount
- defNumSuggestedAccounts :: Int
- suggestedPostings :: MonadIO m => AccountName -> Maybe AssertedAmount -> AddT m (E.NonEmpty EditablePosting)
- next :: EditablePosting -> EditablePosting
- roundP :: EditablePosting -> EditablePosting
- assignOpenBalance :: Decimal -> EditablePostings -> EditablePostings
- showEditablePosting :: EditablePostings -> T.Text
- totalBalance :: [EditablePosting] -> MixedAmount
- showAmount2 :: Amount -> T.Text
- showMixedAmount2 :: MixedAmount -> T.Text
- addNewPosting :: Bool -> EditablePostings -> AddT IO EditablePostings
- moveToNextEmpty :: EditablePostings -> EditablePostings
- data Align
- fillLeft
- fillRight
- fillCenter
- renderTable :: ([Align], [Align], [T.Text]) -> [[T.Text]] -> Maybe [T.Text] -> T.Text
Types
type AddOptions = FullOptions [Partner] Source #
Partner | |
|
partners :: (MonadReader AddOptions m, MonadError Msg m) => m [Partner] Source #
Extract partner information from the env and throw errors if there are any readPartner :: (MonadReader AddOptions m, MonadError Msg m) => (Partner -> a) -> m (Maybe a) readPartner f = reader $ fmap f . oEnv
Entry point
:: Maybe Transaction | matching transaction for clearing |
-> Bool | clear the matching transactions |
-> (Maybe Transaction, [(Partner, Transaction)]) | transactioons to be saved: ((user's,other's), |
-> AddT IO () |
Saves transaction into the designated ledgers files of each user,
and clears the transaction tht was matched (conditional on a Bool
argument)
clearSecondPosting :: Transaction -> (Transaction, Transaction) Source #
infoNewTx
split :: [EditablePosting] -> ([Posting], [(Partner, E.NonEmpty Posting, MixedAmount)]) Source #
Split EditablePosting
s in User's Postings and (Partner,
Postings, Open Balance)
:: (MonadIO m, MonadReader AddOptions m) | |
=> Bool | require balanced transactions |
-> Maybe (Transaction, [EditablePosting]) | the transaction and postings to be combined |
-> m (Maybe Transaction, [(Partner, Transaction)]) | (user's, partners') transactions |
generate the main and possibly the other users' transactions
myJournalAddTransaction :: FilePath -> [Transaction] -> AddT IO Journal Source #
add transaction to ledger file
clearNthPosting :: Int -> Transaction -> Transaction Source #
Transaction suggestions
type AssertedAmount = Asserted MixedAmount Source #
fromPosting :: Posting -> Asserted MixedAmount Source #
showAssertedAmount :: Asserted MixedAmount -> T.Text Source #
sugTrans :: AddT IO (AssertedAmount, Maybe Transaction) Source #
Ask an amount, and return transactions matching the entered amount
stripP
Main editing loop
myEd :: EditorConf (AddT IO) EditablePosting Transaction Source #
combines everything into an EditorConf
mainPrompt :: (ListLike m item, IsString m) => m Source #
clearTrans :: Zipper EditablePosting -> Zipper EditablePosting Source #
clear all postings
nextNotFirst :: EditablePosting -> EditablePosting Source #
change user of current posting, but not for the first posting ReferenceA
balanceTransactionIfRequired :: Transaction -> Either String Transaction Source #
balanceRequirement :: MonadError String m => [Posting] -> m Balancing Source #
check, if the transaction should be passed through
balanceTransaction
to infer missing amounts
checkDone :: LState EditablePosting Transaction -> AddT IO (Maybe (LState EditablePosting Transaction)) Source #
Try to balance the transactions and present the final transactions
Asking (with completion)
dateandcodep :: MP.Parser (SmartDate, T.Text) Source #
HLedger's smartdate
and code
myAskAccount
:: Maybe AssertedAmount | default value, if "" is entered |
-> T.Text | prompt |
-> Maybe T.Text | initial |
-> AddT IO AssertedAmount |
parseAmount :: Journal -> T.Text -> Either (ParseError Char Dec) AssertedAmount Source #
_amountp2
nosymbolamountp2 :: Monad m => JournalStateParser m Amount Source #
getDefaultCommodityAndStyle2 :: Journal -> Maybe (CommoditySymbol, AmountStyle) Source #
askPercent :: IO Decimal Source #
Posting and Suggestions
data EditablePosting Source #
Type holding suggested or temporary postings
type EditablePostings = Zipper EditablePosting Source #
editablePosting
addPosting :: AccountName -> Maybe AssertedAmount -> EditablePosting -> EditablePosting Source #
generate and add new Posting
to EditablePosting
editCurAmount :: EditablePostings -> AddT IO EditablePostings Source #
edit the amount of the selected posting
:: (AssertedAmount -> AssertedAmount -> AssertedAmount) | oldAmout -> enteredAmount -> newAmount |
-> Bool | Show old amound |
-> EditablePostings | |
-> AddT IO EditablePostings |
modfiy current amount by asking for a new amount, that is combined with the old to get a new amount (e.g. with (+))
replaceMissing :: MixedAmount -> MixedAmount Source #
defNumSuggestedAccounts :: Int Source #
Hardcoded default number of suggested accounts
suggestedPostings :: MonadIO m => AccountName -> Maybe AssertedAmount -> AddT m (E.NonEmpty EditablePosting) Source #
retrieve a number of suggested contra postings for a given account, sort frequency of that contra account for the given account.
duplicate each posting for both users, but only if the other user's account is present in the suggestions.
next :: EditablePosting -> EditablePosting Source #
change posting's user to the next user
assignOpenBalance :: Decimal -> EditablePostings -> EditablePostings Source #
assign the Transaction'
s open balance to an empty EditablePosting
totalBalance :: [EditablePosting] -> MixedAmount Source #
showAmount2 :: Amount -> T.Text Source #
showMixedAmount2 :: MixedAmount -> T.Text Source #
:: Bool | for next partner |
-> EditablePostings | |
-> AddT IO EditablePostings |
ask for new account (display old as default) and use existing posting, if same account without a posting/amount already exists or append.
moveToNextEmpty :: EditablePostings -> EditablePostings Source #
move the focus to the next empty posting
Pretty Table Printer
fillLeft
fillRight
fillCenter