blob: a11434594a30439472fb5f2e37e27d15de44733e (
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
|
(.module:
lux
(lux (control [monad #+ do]))
(//// [compiler]
[analysis #+ Variant Tuple]
[synthesis #+ Synthesis]
(host ["_" scheme #+ Expression]))
[//runtime #+ Operation Translator]
[//primitive])
(def: #export (tuple translate elemsS+)
(-> Translator (Tuple Synthesis) (Operation Expression))
(case elemsS+
#.Nil
(//primitive.text synthesis.unit)
(#.Cons singletonS #.Nil)
(translate singletonS)
_
(do compiler.Monad<Operation>
[elemsT+ (monad.map @ translate elemsS+)]
(wrap (_.vector/* elemsT+)))))
(def: #export (variant translate [lefts right? valueS])
(-> Translator (Variant Synthesis) (Operation Expression))
(do compiler.Monad<Operation>
[valueT (translate valueS)]
(wrap (//runtime.variant [lefts right? valueT]))))
|