Safe Haskell | None |
---|
Penny - extensible double-entry accounting system
- data Version = Version {
- versionBranch :: [Int]
- versionTags :: [String]
- data Defaults = Defaults {
- caseSensitive :: Bool
- matcher :: Matcher
- colorToFile :: Bool
- expressionType :: ExprDesc
- defaultScheme :: Maybe Scheme
- additionalSchemes :: [Scheme]
- sorter :: [(SortField, SortOrder)]
- balanceFormat :: Commodity -> Qty -> Text
- balanceShowZeroBalances :: Bool
- balanceOrder :: SortOrder
- convertShowZeroBalances :: Bool
- convertTarget :: Target
- convertOrder :: SortOrder
- convertSortBy :: SortBy
- convertFormat :: Commodity -> Qty -> Text
- postingsFields :: Fields Bool
- postingsWidth :: Int
- postingsShowZeroBalances :: Bool
- postingsDateFormat :: (PostMeta, Posting) -> Text
- postingsQtyFormat :: (PostMeta, Posting) -> Text
- postingsBalanceFormat :: Commodity -> Qty -> Text
- postingsSubAccountLength :: Int
- postingsPayeeAllocation :: Int
- postingsAccountAllocation :: Int
- postingsSpacers :: Spacers Int
- data Matcher
- data Scheme = Scheme {}
- type Changers = Labels (EvenAndOdd (Chunk -> Chunk))
- data Labels a = Labels {}
- data EvenAndOdd a = EvenAndOdd {}
- module System.Console.Rainbow
- data SortField
- = Payee
- | Date
- | Flag
- | Number
- | Account
- | DrCr
- | Qty
- | Commodity
- | PostingMemo
- | TransactionMemo
- data SortOrder
- = Ascending
- | Descending
- data ExprDesc
- defaultQtyFormat :: Qty -> Text
- data Target
- data SortBy
- = SortByQty
- | SortByName
- data Fields a = Fields {
- fGlobalTransaction :: a
- fRevGlobalTransaction :: a
- fGlobalPosting :: a
- fRevGlobalPosting :: a
- fFileTransaction :: a
- fRevFileTransaction :: a
- fFilePosting :: a
- fRevFilePosting :: a
- fFiltered :: a
- fRevFiltered :: a
- fSorted :: a
- fRevSorted :: a
- fVisible :: a
- fRevVisible :: a
- fLineNum :: a
- fDate :: a
- fFlag :: a
- fNumber :: a
- fPayee :: a
- fAccount :: a
- fPostingDrCr :: a
- fPostingCmdty :: a
- fPostingQty :: a
- fTotalDrCr :: a
- fTotalCmdty :: a
- fTotalQty :: a
- fTags :: a
- fMemo :: a
- fFilename :: a
- data Spacers a = Spacers {
- sGlobalTransaction :: a
- sRevGlobalTransaction :: a
- sGlobalPosting :: a
- sRevGlobalPosting :: a
- sFileTransaction :: a
- sRevFileTransaction :: a
- sFilePosting :: a
- sRevFilePosting :: a
- sFiltered :: a
- sRevFiltered :: a
- sSorted :: a
- sRevSorted :: a
- sVisible :: a
- sRevVisible :: a
- sLineNum :: a
- sDate :: a
- sFlag :: a
- sNumber :: a
- sPayee :: a
- sAccount :: a
- sPostingDrCr :: a
- sPostingCmdty :: a
- sPostingQty :: a
- sTotalDrCr :: a
- sTotalCmdty :: a
- widthFromRuntime :: Runtime -> Int
- yearMonthDay :: (PostMeta, Posting) -> Text
- qtyAsIs :: (PostMeta, Posting) -> Text
- balanceAsIs :: a -> Qty -> Text
- data Runtime
- environment :: Runtime -> [(String, String)]
- data Text
- pack :: String -> Text
- runPenny :: Version -> (Runtime -> Defaults) -> IO ()
Building a custom Penny binary
Everything you need to create a custom Penny program is available by importing only this module.
data Version
A Version
represents the version of a software entity.
An instance of Eq
is provided, which implements exact equality
modulo reordering of the tags in the versionTags
field.
An instance of Ord
is also provided, which gives lexicographic
ordering on the versionBranch
fields (i.e. 2.1 > 2.0, 1.2.3 > 1.2.2,
etc.). This is expected to be sufficient for many uses, but note that
you may need to use a more specific ordering for your versioning
scheme. For example, some versioning schemes may include pre-releases
which have tags "pre1"
, "pre2"
, and so on, and these would need to
be taken into account when determining ordering. In some cases, date
ordering may be more appropriate, so the application would have to
look for date
tags in the versionTags
field and compare those.
The bottom line is, don't always assume that compare
and other Ord
operations are the right thing for every Version
.
Similarly, concrete representations of versions may differ. One
possible concrete representation is provided (see showVersion
and
parseVersion
), but depending on the application a different concrete
representation may be more appropriate.
Version | |
|
This type contains settings for all the reports, as well as default settings for the global options. Some of these can be overridden on the command line.
Defaults | |
|
Color schemes
module System.Console.Rainbow
Sorting
Expression type
Formatting quantities
defaultQtyFormat :: Qty -> TextSource
Convert report options
The commodity to which to convert the commodities in the convert report.
AutoTarget | Selects a target commodity automatically, based on which commodity is the most common target commodity in the prices in your ledger files. If there is a tie for most common target commodity, the target that appears later in your ledger files is used. |
ManualTarget String | Always uses the commodity named by the string given. |
Postings report options
Fields | |
|
Spacers | |
|
widthFromRuntime :: Runtime -> IntSource
Gets the current screen width from the runtime. If the COLUMNS environment variable is not set, uses 80.
yearMonthDay :: (PostMeta, Posting) -> TextSource
Shows the date of a posting in YYYY-MM-DD format.
qtyAsIs :: (PostMeta, Posting) -> TextSource
Shows the quantity of a posting. Does no rounding or prettification; simply uses show on the underlying Decimal.
balanceAsIs :: a -> Qty -> TextSource
Shows the quantity of a balance. If there is no quantity, shows two dashes.
Runtime
environment :: Runtime -> [(String, String)]Source
Text
data Text
A space efficient, packed, unboxed Unicode text type.
Eq Text | |
Data Text | |
Ord Text | |
Read Text | |
Show Text | |
Typeable Text | |
IsString Text | |
Monoid Text | |
NFData Text | |
Hashable Text | |
HasText Text | |
(Contravariant f, Functor f) => Contains f Text | |
Applicative f => Ixed f Text | |
Monad m => Stream Text m Char | |
Applicative f => Each f Text Text Char Char |
|
Main function
:: Version | Version of the executable |
-> (Runtime -> Defaults) | runPenny will apply this function to the Runtime. This way the defaults you use can vary depending on environment variables, the terminal type, the date, etc. |
-> IO () |
Creates an IO action that you can use for the main function.
Developer overview
Penny is organized into a tree of modules, each with a name. Check out the links for details on each component of Penny.
Penny.Brenner - Penny financial institution transaction handling. Depends on Lincoln and Copper.
Penny.Cabin - Penny reports. Depends on Lincoln and Liberty.
Penny.Copper - the Penny parser. Depends on Lincoln.
Penny.Liberty - Penny command line parser helpers. Depends on Lincoln and Copper.
Penny.Lincoln - the Penny core. Depends on no other Penny components.
Penny.Shield - the Penny runtime environment. Depends on Lincoln.
Penny.Steel - independent utilities. Depends on no other Penny components.
Penny.Wheat - tools to use with Penny.Steel.Prednote. Depends on Steel, Lincoln, and Copper.
Penny.Zinc - the Penny command-line interface. Depends on Cabin, Copper, Liberty, and Lincoln.
The dependencies are represented as a dot file in bindocdependencies.dot in the Penny git repository.