From 498af2e0123c1ce65e46bf15fe3854266ad58f53 Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Sun, 21 Jan 2018 12:58:48 -0400
Subject: - WIP: Host procedures for JS.
---
.../luxc/lang/translation/js/structure.jvm.lux | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 new-luxc/source/luxc/lang/translation/js/structure.jvm.lux
(limited to 'new-luxc/source/luxc/lang/translation/js/structure.jvm.lux')
diff --git a/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux
new file mode 100644
index 000000000..54f578bee
--- /dev/null
+++ b/new-luxc/source/luxc/lang/translation/js/structure.jvm.lux
@@ -0,0 +1,30 @@
+(.module:
+ lux
+ (lux (control [monad #+ do])
+ (data [text]
+ text/format)
+ [macro])
+ (luxc ["&" lang]
+ (lang [synthesis #+ Synthesis]))
+ [//]
+ (// [".T" runtime]))
+
+(def: #export (translate-tuple translate elemsS+)
+ (-> (-> Synthesis (Meta //.Expression)) (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 (format "[" (text.join-with "," elemsT+) "]")))))
+
+(def: #export (translate-variant translate tag tail? valueS)
+ (-> (-> Synthesis (Meta //.Expression)) Nat Bool Synthesis (Meta //.Expression))
+ (do macro.Monad
+ [valueT (translate valueS)]
+ (wrap (runtimeT.variant tag tail? valueT))))
--
cgit v1.2.3