penny-lib-0.6.0.0: Extensible double-entry accounting system - library

Safe HaskellNone

Penny.Lincoln.Predicates

Contents

Description

Functions that return a boolean based upon some criterion that matches something, often a PostFam. Useful when filtering Postings.

Synopsis

Matching helpers

match :: HasText a => (Text -> Bool) -> a -> BoolSource

matchAny :: HasTextList a => (Text -> Bool) -> a -> BoolSource

Does the given matcher match any of the elements of the Texts in a HasTextList?

matchLevel :: HasTextList a => Int -> (Text -> Bool) -> a -> BoolSource

Does the given matcher match the text that is at the given element of a HasTextList? If the HasTextList does not have a sufficent number of elements to perform this test, returns False.

matchMemo :: (Text -> Bool) -> Maybe Memo -> BoolSource

Does the matcher match the text of the memo? Joins each line of the memo with a space.

Pattern matching fields

Date

Qty

qty :: (Qty -> Bool) -> PostFam -> BoolSource

DrCr

Matching delimited fields

Commodity

Account

Tags

Combining predicates

(&&&) :: (a -> Bool) -> (a -> Bool) -> a -> BoolSource

(|||) :: (a -> Bool) -> (a -> Bool) -> a -> BoolSource

Clones

clonedTransactions :: Transaction -> Transaction -> BoolSource

Returns True if these two transactions are clones; that is, if they are identical in all respects except some aspects of their metadata. The metadata that is disregarded when testing for clones pertains to the location of the transaction. (Resembles cloned sheep, which are identical but cannot be in exactly the same place.)

clonedTopLines :: TopLine -> TopLine -> BoolSource

Returns True if two TopLines are clones. Considers only the non-metadata aspects of the TopLine; the metadata all pertains only to the location of the TopLine. The DateTimes are compared based on both the local time and the time zone; that is, two times that refer to the same instant will not compare as identical if they have different time zones.

clonedPostings :: Posting -> Posting -> BoolSource

Returns True if two Postings are clones. Considers only the non-location-related aspects of the posting metadata.