{-# LANGUAGE DeriveAnyClass #-} module Literate.Accounting ( module Literate.Accounting, module Literate.Accounting.Amount, module Literate.Accounting.Flow, module Literate.Accounting.Quantity, module Literate.Accounting.Unit, ) where import Literate.Accounting.Amount import Literate.Accounting.Flow import Literate.Accounting.Quantity import Literate.Accounting.Unit import Literate.Prelude import Literate.Time type Euro = Amount 100 (UnitName "€") data Movement cause account amounts = Movement { moveDescription :: Text , moveDate :: LocalTime , movePostings :: [Posting account amounts] , moveCause :: Set cause } deriving (Eq, Show) data Posting account amounts = Posting { postingAccount :: account , postingFlow :: Flow amounts } deriving (Eq, Show, NFData, Generic) equalPostings :: account -> account -> amounts -> [Posting account amounts] equalPostings from to amts = [ Posting { postingAccount = from , postingFlow = FlowSource amts } , Posting { postingAccount = to , postingFlow = FlowDest amts } ]