]> Git — Sourcephile - comptalang.git/blob - ledger/Hcompta/Ledger/Account.hs
Adapte hcompta-ledger.
[comptalang.git] / ledger / Hcompta / Ledger / Account.hs
1 {-# LANGUAGE DeriveDataTypeable #-}
2 module Hcompta.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.Regex.TDFA (Regex)
10 import Text.Show (Show)
11
12 -- import qualified Hcompta as H
13 import Text.Regex.TDFA.Show ()
14
15 -- * Type 'Account'
16
17 type Account_Section = Text
18 type Account = NonEmpty Account_Section
19 account :: Account_Section -> [Account_Section] -> Account
20 account = (:|)
21
22 -- ** Type 'Joker'
23
24 type Account_Joker
25 = [Account_Joker_Section]
26 data Account_Joker_Section
27 = Account_Joker_Any
28 | Account_Joker_Section Text
29 deriving (Data, Eq, Show, Typeable)
30
31 -- ** Type 'Pattern'
32
33 data Account_Pattern
34 = Account_Pattern_Exact Account
35 | Account_Pattern_Joker Account_Joker
36 | Account_Pattern_Regex Regex
37 deriving (Show, Typeable)