]> Git — Sourcephile - comptalang.git/blob - lib/Hcompta/Model/Transaction/Tag.hs
Ajout : Calc.Balance.infer_equilibre
[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 import Data.Text (Text)
6
7 type Tag = (Name, Value)
8
9 type Name = Text
10
11 type Value = Text
12
13 type By_Name = Data.Map.Map Name [Value]
14
15 -- | Return a 'Data.Map.Map' associating the 'Value's of the given 'Tag's with their respective 'Name'.
16 from_List :: [Tag] -> By_Name
17 from_List tags =
18 Data.Map.fromListWith (flip (++)) $
19 Data.List.map (\(n, v) -> (n, [v])) tags