]> Git — Sourcephile - comptalang.git/blob - ledger/Hcompta/Format/Ledger/Account.hs
.gitignore
[comptalang.git] / ledger / Hcompta / Format / Ledger / Account.hs
1 {-# LANGUAGE DeriveDataTypeable #-}
2 module Hcompta.Format.Ledger.Account where
3
4 import Data.Data (Data(..))
5 import Data.Eq (Eq(..))
6 import Data.List.NonEmpty (NonEmpty(..))
7 import Data.Text (Text)
8 import Data.Typeable (Typeable)
9 import Text.Show (Show)
10
11 import Hcompta.Lib.Parsec ()
12 import Hcompta.Lib.Regex (Regex)
13
14 -- * Type 'Account'
15
16 type Account_Section = Text
17 type Account = NonEmpty Account_Section
18 account :: Account_Section -> [Account_Section] -> Account
19 account = (:|)
20
21 -- ** Type 'Joker'
22
23 type Account_Joker
24 = [Account_Joker_Section]
25 data Account_Joker_Section
26 = Account_Joker_Any
27 | Account_Joker_Section Text
28 deriving (Data, Eq, Show, Typeable)
29
30 -- ** Type 'Pattern'
31
32 data Account_Pattern
33 = Account_Pattern_Exact Account
34 | Account_Pattern_Joker Account_Joker
35 | Account_Pattern_Regex Regex
36 deriving (Show, Typeable)