diff options
Diffstat (limited to 'stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.lux | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.lux new file mode 100644 index 000000000..e44ab508b --- /dev/null +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.lux @@ -0,0 +1,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])))) |