{-# LANGUAGE DeriveDataTypeable #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Hcompta.Model.Journal where import Data.Data import qualified Data.Map.Strict as Data.Map import Data.Typeable () import qualified Data.Foldable import Data.Foldable (Foldable) import qualified Hcompta.Model.Transaction as Transaction data Journal = Journal { transactions :: Transaction.By_Date } deriving (Data, Eq, Read, Show, Typeable) nil :: Journal nil = Journal { transactions = Data.Map.empty } union :: Journal -> Journal -> Journal union Journal { transactions=t0 } Journal { transactions=t1 } = Journal { transactions = Data.Map.unionWith (++) t0 t1 } unions :: Foldable t => t Journal -> Journal unions = Data.Foldable.foldl (flip Hcompta.Model.Journal.union) Hcompta.Model.Journal.nil