blob: fd5480bc6930b69bc610ed3aeb4cfbb90a77395c (
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
|
(.module:
[lux (#- type)
[type (#+ :by-example)
abstract]])
(abstract: #export (Class t c q)
(-> t c)
(def: #export class
(All [t c]
(Ex [q]
(-> (-> t c) (Class t c q))))
(|>> :abstraction))
(abstract: #export (Quotient t c q)
{#value t
#label c}
(def: #export (quotient class value)
(All [t c q]
(-> (Class t c q) t
(Quotient t c q)))
(:abstraction {#value value
#label ((:representation Class class) value)}))
(template [<name> <output> <slot>]
[(def: #export <name>
(All [t c q] (-> (Quotient t c q) <output>))
(|>> :representation (get@ <slot>)))]
[value t #value]
[label c #label]
)
)
)
(template: #export (type <class>)
(:by-example [t c q]
{(..Class t c q)
<class>}
(..Quotient t c q)))
|