{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Hcompta.LCC.Account where import Control.DeepSeq (NFData(..)) import Data.Data (Data(..)) import Data.Eq (Eq(..)) -- import Data.List.NonEmpty (NonEmpty(..)) import Data.Monoid (Monoid(..)) import Data.NonNull (NonNull) import Data.Ord (Ord(..)) import Data.Semigroup (Semigroup(..)) import Data.Typeable (Typeable) import Text.Show (Show) import qualified Data.MonoTraversable as MT -- import qualified Data.NonNull as NonNull import qualified Data.TreeMap.Strict as TreeMap -- import Hcompta.LCC.Anchor import Hcompta.LCC.Tag import Hcompta.LCC.Name import qualified Hcompta as H -- * Type 'Account' newtype Account = Account (NonNull [Account_Section]) deriving (Data, Eq, MT.MonoFunctor, MT.MonoFoldable , NFData, Ord, Semigroup, Show, Typeable) type instance MT.Element Account = Account_Section instance H.Get (TreeMap.Path Account_Section) Account where get (Account n) = n instance H.Get Account (TreeMap.Path Account_Section) where get = Account instance H.Account Account -- ** Type 'Account_Section' type Account_Section = Name {- -- * Type 'Account_Anchor' newtype Account_Anchor = Account_Anchor Anchor deriving (Data, Eq, Ord, NFData, Show, Typeable) -- ** Type 'Account_Anchors' newtype Account_Anchors = Account_Anchors Anchors deriving (Data, Eq, Monoid, NFData, Ord, Semigroup, Show, Typeable) type instance MT.Element Account_Anchors = Account_Anchor -} -- * Type 'Account_Tag' newtype Account_Tag = Account_Tag Tag deriving (Data, Eq, NFData, Show, Typeable) instance MT.MonoFunctor Account_Tag where omap f (Account_Tag tag) = Account_Tag (f tag) type instance MT.Element Account_Tag = Tag type instance H.Tag_Path H.:@ Account_Tag = Tag_Path type instance H.Tag_Data H.:@ Account_Tag = Tag_Data -- ** Type 'Account_Tags' newtype Account_Tags = Account_Tags Tags deriving (Data, Eq, Monoid, NFData, Semigroup, Show, Typeable) type instance MT.Element Account_Tags = Account_Tag instance H.GetI H.Tag_Path Account_Tag where getI_ _ (Account_Tag tag) = tag_path tag instance H.SetI H.Tag_Path Account_Tag where setI_ _ tag_path = MT.omap (\tag -> tag{tag_path}) instance H.GetI H.Tag_Data Account_Tag where getI_ _ (Account_Tag tag) = tag_data tag instance H.SetI H.Tag_Data Account_Tag where setI_ _ tag_data = MT.omap (\tag -> tag{tag_data})