Copyright | Kadzuya Okamoto 2017 |
---|---|
License | MIT |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
This module exports core functions and types for bookkeeping.
- ppr :: Transactions -> IO ()
- year :: Year -> YearTransactions -> Transactions
- month :: Month -> MonthTransactions -> YearTransactions
- activity :: Date -> Description -> DateTransactions -> MonthTransactions
- dateTrans :: DebitCategory -> CreditCategory -> SubDescription -> Amount -> DateTransactions
- runTransactions :: Transactions -> [Transaction]
- type Transactions = Trans Transaction
- type YearTransactions = Trans (Year -> Transaction)
- type MonthTransactions = Trans (Month -> Year -> Transaction)
- type DateTransactions = Trans (Date -> Description -> Month -> Year -> Transaction)
- data Transaction = Transaction {}
- newtype Year = Year {}
- newtype Month = Month {}
- newtype Date = Date {}
- newtype Description = Description {}
- newtype SubDescription = SubDescription {}
- newtype Amount = Amount {}
- data Category = Category {}
- newtype CategoryName = CategoryName {}
- data CategoryType
- = Assets
- | Liabilities
- | Stock
- | Revenue
- | Expenses
- newtype DebitCategory = DebitCategory {}
- newtype CreditCategory = CreditCategory {}
Usage examples
>>>
:{
let advance :: CategoryName -> SubDescription -> Amount -> DateTransactions advance name = dateTrans (DebitCategory $ Category name Expenses) (CreditCategory $ Category "Deposit" Assets) sample = year 2015 $ do month 1 $ do activity 1 "Constant expenses" $ advance "Communication" "Mobile phone" 3000 activity 3 "Mail a contract" $ do advance "Communication" "Stamp" 50 advance "Office supplies" "Envelope" 100 month 2 $ activity 1 "Constant expenses" $ advance "Communication" "Mobile phone" 3000 :}
Pritty printers
ppr :: Transactions -> IO () Source #
A pretty printer for Transactions
.
>>>
ppr sample
tDay: 2015-01-01 tDescription: Constant expenses tSubDescription: Mobile phone tDebit: Communication (Expenses) tCredit: Deposit (Assets) tAmount: 3000 tDay: 2015-01-03 tDescription: Mail a contract tSubDescription: Stamp tDebit: Communication (Expenses) tCredit: Deposit (Assets) tAmount: 50 tDay: 2015-01-03 tDescription: Mail a contract tSubDescription: Envelope tDebit: Office supplies (Expenses) tCredit: Deposit (Assets) tAmount: 100 tDay: 2015-02-01 tDescription: Constant expenses tSubDescription: Mobile phone tDebit: Communication (Expenses) tCredit: Deposit (Assets) tAmount: 3000
Constructors
year :: Year -> YearTransactions -> Transactions Source #
Convert from YearTransactions
to Transactions
.
month :: Month -> MonthTransactions -> YearTransactions Source #
Convert from MonthTransactions
to YearTransactions
.
activity :: Date -> Description -> DateTransactions -> MonthTransactions Source #
Convert from DateTransactions
to MonthTransactions
.
dateTrans :: DebitCategory -> CreditCategory -> SubDescription -> Amount -> DateTransactions Source #
Converters
runTransactions :: Transactions -> [Transaction] Source #
Take list of Transaction
out from Transactions
.
Types
type Transactions = Trans Transaction Source #
A type for handling Transaction
values.
type YearTransactions = Trans (Year -> Transaction) Source #
type MonthTransactions = Trans (Month -> Year -> Transaction) Source #
type DateTransactions = Trans (Date -> Description -> Month -> Year -> Transaction) Source #
data Transaction Source #
A type representing a transaction.
newtype Description Source #
newtype SubDescription Source #
A type representing an accounts title.
newtype CategoryName Source #
data CategoryType Source #
newtype DebitCategory Source #