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