blob: a75e1a7a1a6eea4444670003c5536b947bcc6128 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
(.module:
lux
(lux (data [text]
(coll [list "list/" Fold<List>]
[dict #+ Dict]))))
(type: #export Influences (Dict Text (List Text)))
(def: #export (track to from)
(-> Text Text Influences Influences)
(|>> (dict.update~ from (list) (|>> (#.Cons to)))
(dict.update~ to (list) id)))
(def: (effluents module influences)
(-> Text Influences (Maybe (List Text)))
(dict.get module influences))
(def: #export (untrack module influences)
(-> Text Influences Influences)
(case (effluents module influences)
(#.Some effluents)
(list/fold untrack (dict.remove module influences) effluents)
#.None
influences))
(def: #export empty Influences (dict.new text.Hash<Text>))
|