1 module Hcompta.For where
3 import Data.Map.Strict (Map)
4 import qualified Data.TreeMap.Strict as TM
5 import qualified Data.MonoTraversable as MT
8 -- * Type family 'NameFor'
9 type family NameFor a :: *
10 type instance NameFor [a] = NameFor a
11 type instance NameFor (a, b) = NameFor a
12 type instance NameFor (TM.Path a) = a
15 -- * Type family 'UnitFor'
16 type family UnitFor a :: *
17 type instance UnitFor [a] = UnitFor a
18 type instance UnitFor (a, b) = UnitFor b
19 type instance UnitFor (Map unit qty) = unit
21 -- * Type family 'QuantityFor'
22 type family QuantityFor a :: *
23 type instance QuantityFor [a] = QuantityFor a
24 type instance QuantityFor (a, b) = QuantityFor b
25 type instance QuantityFor (Map unit qty) = qty
27 -- * Type family 'DateFor'
28 type family DateFor a :: *
30 -- * Type family 'AccountFor'
31 type family AccountFor a :: *
32 type instance AccountFor [a] = AccountFor a
33 type instance AccountFor (TM.Path name, Map unit qty) = TM.Path name
36 type NameFor a = MT.Element (AccountFor a)
38 -- * Type family 'PostingsFor'
39 type family PostingsFor a :: *
41 -- * Type family 'AmountFor'
42 type family AmountFor a :: *