(.module:
lux
(lux (control [monad #+ do])
(data [text]
text/format)
[macro])
(luxc ["&" lang]
(lang [synthesis #+ Synthesis]
(host ["_" php #+ Expression Computation])))
[//]
(// [".T" runtime]))
(def: #export (translate-tuple translate elemsS+)
(-> //.Translator (List Synthesis) (Meta Expression))
(case elemsS+
#.Nil
(:: macro.Monad wrap runtimeT.unit)
(#.Cons singletonS #.Nil)
(translate singletonS)
_
(do macro.Monad
[elemsT+ (monad.map @ translate elemsS+)]
(wrap (_.array/* elemsT+)))))
(def: #export (translate-variant translate tag tail? valueS)
(-> //.Translator Nat Bool Synthesis (Meta Computation))
(do macro.Monad
[valueT (translate valueS)]
(wrap (runtimeT.variant tag tail? valueT))))