Safe Haskell | Safe-Infered |
---|
Penny.Copper
Description
Copper - the Penny parser
- data Comment = Comment Text
- data RadGroup
- periodComma :: RadGroup
- periodSpace :: RadGroup
- commaPeriod :: RadGroup
- commaSpace :: RadGroup
- data GroupingSpec
- = NoGrouping
- | GroupLarge
- | GroupAll
- newtype DefaultTimeZone = DefaultTimeZone TimeZoneOffset
- utcDefault :: DefaultTimeZone
- newtype FileContents = FileContents {}
- newtype ErrorMsg = ErrorMsg {
- unErrorMsg :: Text
- data Item
- data Line
- data Ledger = Ledger {}
- parse :: DefaultTimeZone -> RadGroup -> [(Filename, FileContents)] -> Exceptional ErrorMsg Ledger
- render :: DefaultTimeZone -> (GroupingSpec, GroupingSpec) -> RadGroup -> Item -> Maybe Text
Comments
Radix and grouping
Radix is period, grouping is comma
Radix is period, grouping is space
Radix is comma, grouping is period
Radix is comma, grouping is space
data GroupingSpec Source
Specifies how to perform digit grouping when rendering a quantity. All grouping groups into groups of 3 digits.
Constructors
NoGrouping | Do not perform any digit grouping |
GroupLarge | Group digits, but only if the number to be grouped is greater than 9,999 (if grouping the whole part) or if there are more than 4 decimal places (if grouping the fractional part). |
GroupAll | Group digits whenever there are at least four decimal places. |
Instances
Default time zone
FileContents
Errors
Constructors
ErrorMsg | |
Fields
|
Items
An Item is used both to hold the result of parsing an item from a file and for rendering. It is parameterized on two types: the metadata type for the TopLine, and the metadata type for the Posting.
Constructors
Transaction Transaction | |
Price PricePoint | |
CommentItem Comment | |
BlankLine |
Parsing
parse :: DefaultTimeZone -> RadGroup -> [(Filename, FileContents)] -> Exceptional ErrorMsg LedgerSource
Rendering
render :: DefaultTimeZone -> (GroupingSpec, GroupingSpec) -> RadGroup -> Item -> Maybe TextSource