]> Git — Sourcephile - comptalang.git/blob - lib/Hcompta/Model/Transaction/Tag.hs
Ajout : Format.Ledger.Read.journal
[comptalang.git] / lib / Hcompta / Model / Transaction / Tag.hs
1 module Hcompta.Model.Transaction.Tag where
2
3 import qualified Data.List
4 import qualified Data.Map.Strict as Data.Map
5
6 type Tag = (Name, Value)
7
8 type Name = String
9
10 type Value = String
11
12 type By_Name = Data.Map.Map Name [Value]
13
14 -- | Return a 'Data.Map.Map' associating the 'Value's of the given 'Tag's with their respective 'Name'.
15 from_List :: [Tag] -> By_Name
16 from_List tags =
17 Data.Map.fromListWith (++) $
18 Data.List.map (\(n, v) -> (n, [v])) tags