diff --git a/dhall/Types.dhall b/dhall/Types.dhall index 64fc071..dcc0f1c 100644 --- a/dhall/Types.dhall +++ b/dhall/Types.dhall @@ -230,16 +230,21 @@ let Transfer = , transCurrency : CurID } +let AcntSet = + { Type = { asList : List AcntID, asInclude : Bool } + , default = { asList = [] : List AcntID, asInclude = False } + } + let ShadowMatch = { Type = - { smFrom : List AcntID - , smTo : List AcntID + { smFrom : AcntSet.Type + , smTo : AcntSet.Type , smDate : Optional MatchDate , smVal : MatchVal.Type } , default = - { smFrom = [] : List AcntID - , smTo = [] : List AcntID + { smFrom = AcntSet.default + , smTo = AcntSet.default , smDate = None MatchDate , smVal = MatchVal.default } @@ -309,4 +314,5 @@ in { CurID , TransferTarget , ShadowMatch , ShadowTransfer + , AcntSet } diff --git a/dhall/common.dhall b/dhall/common.dhall index dfcc338..fa539f3 100644 --- a/dhall/common.dhall +++ b/dhall/common.dhall @@ -4,7 +4,7 @@ let List/map = let T = ./Types.dhall - sha256:3c6121710cb1d4ed84d9cb7ab6589fdcea79d1e4e07b33b22bd84e52506ea80f + sha256:1c88b66bd88326bf72f1eb2d6a3b4d6d57fd51a473482390b2d0b0486a9a60e7 let nullSplit = \(a : T.SplitAcnt) -> diff --git a/lib/Internal/Insert.hs b/lib/Internal/Insert.hs index 7872c53..44b929a 100644 --- a/lib/Internal/Insert.hs +++ b/lib/Internal/Insert.hs @@ -171,8 +171,8 @@ shadowMatches ShadowMatch {smFrom, smTo, smDate, smVal} tx = do && valRes where tx_ = bttTx tx - memberMaybe _ [] = True - memberMaybe xs ys = xs `elem` ys + memberMaybe x AcntSet {asList, asInclude} = + (if asInclude then id else not) $ x `elem` asList balanceTransfers :: [BudgetTxType] -> [BudgetTx] balanceTransfers ts = snd $ L.mapAccumR go initBals $ L.sortOn (btWhen . bttTx) ts diff --git a/lib/Internal/Types.hs b/lib/Internal/Types.hs index 203aa4b..f98362c 100644 --- a/lib/Internal/Types.hs +++ b/lib/Internal/Types.hs @@ -54,6 +54,7 @@ makeHaskellTypesWith , SingleConstructor "Income" "Income" "(./dhall/Types.dhall).Income" , SingleConstructor "Budget" "Budget" "(./dhall/Types.dhall).Budget" , SingleConstructor "Transfer" "Transfer" "(./dhall/Types.dhall).Transfer" + , SingleConstructor "AcntSet" "AcntSet" "(./dhall/Types.dhall).AcntSet.Type" , SingleConstructor "ShadowMatch" "ShadowMatch" "(./dhall/Types.dhall).ShadowMatch.Type" , SingleConstructor "ShadowTransfer" "ShadowTransfer" "(./dhall/Types.dhall).ShadowTransfer" ] @@ -316,6 +317,10 @@ deriving instance Eq ShadowTransfer deriving instance Hashable ShadowTransfer +deriving instance Eq AcntSet + +deriving instance Hashable AcntSet + deriving instance Eq ShadowMatch deriving instance Hashable ShadowMatch