blob: 131d968ef37173081022bfeb6f52493ed241b65b (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
(.module:
[library
[lux {"-" [Type static]}
[abstract
[monad {"+" [do]}]
[equivalence {"+" [Equivalence]}]]
[control
["[0]" try {"+" [Try]}]]
[data
["[0]" product]
["[0]" format "_"
["[1]" binary {"+" [Writer]} ("[1]\[0]" monoid)]]]
[math
[number
["n" nat]]]]]
["[0]" / "_"
["[1][0]" stack {"+" [Stack]}]
["[1][0]" registry {"+" [Registry]}]
[////
[type {"+" [Type]}
[category {"+" [Method]}]]]])
(type: .public Limit
(Record
[#stack Stack
#registry Registry]))
(template [<name> <registry>]
[(def: .public (<name> type)
(-> (Type Method) (Try Limit))
(do try.monad
[registry (<registry> type)]
(in [#stack /stack.empty
#registry registry])))]
[static /registry.static]
[virtual /registry.virtual]
)
(def: .public length
($_ n.+
... u2 max_stack;
/stack.length
... u2 max_locals;
/registry.length))
(def: .public equivalence
(Equivalence Limit)
($_ product.equivalence
/stack.equivalence
/registry.equivalence
))
(def: .public (writer limit)
(Writer Limit)
($_ format\composite
(/stack.writer (value@ #stack limit))
(/registry.writer (value@ #registry limit))
))
|