]> Git — Sourcephile - comptalang.git/blob - lib/Hcompta/For.hs
stack: bump to lts-12.25
[comptalang.git] / lib / Hcompta / For.hs
1 module Hcompta.For where
2
3 import Data.Map.Strict (Map)
4 import qualified Data.TreeMap.Strict as TM
5 import qualified Data.MonoTraversable as MT
6
7 {-
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
13 -}
14
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
20
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
26
27 -- * Type family 'DateFor'
28 type family DateFor a :: *
29
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
34
35 -- ** Type 'NameFor'
36 type NameFor a = MT.Element (AccountFor a)
37
38 -- * Type family 'PostingsFor'
39 type family PostingsFor a :: *
40
41 -- * Type family 'AmountFor'
42 type family AmountFor a :: *