aboutsummaryrefslogtreecommitdiff
path: root/source/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'source/lux.lux')
-rw-r--r--source/lux.lux43
1 files changed, 23 insertions, 20 deletions
diff --git a/source/lux.lux b/source/lux.lux
index f5cc8d3d1..39cbb7765 100644
--- a/source/lux.lux
+++ b/source/lux.lux
@@ -9,23 +9,23 @@
## Basic types
(_lux_def Bool (10 ["lux" "Bool"]
- (0 "java.lang.Boolean")))
+ (0 "java.lang.Boolean" (0))))
(_lux_export Bool)
(_lux_def Int (10 ["lux" "Int"]
- (0 "java.lang.Long")))
+ (0 "java.lang.Long" (0))))
(_lux_export Int)
(_lux_def Real (10 ["lux" "Real"]
- (0 "java.lang.Double")))
+ (0 "java.lang.Double" (0))))
(_lux_export Real)
(_lux_def Char (10 ["lux" "Char"]
- (0 "java.lang.Character")))
+ (0 "java.lang.Character" (0))))
(_lux_export Char)
(_lux_def Text (10 ["lux" "Text"]
- (0 "java.lang.String")))
+ (0 "java.lang.String" (0))))
(_lux_export Text)
(_lux_def Unit (10 ["lux" "Unit"]
@@ -71,7 +71,7 @@
(_lux_declare-tags [#None #Some] Maybe)
## (deftype #rec Type
-## (| (#DataT Text)
+## (| (#DataT (, Text (List Type)))
## (#VariantT (List Type))
## (#TupleT (List Type))
## (#LambdaT Type Type)
@@ -90,7 +90,7 @@
TypeList
(9 (7 (0)
(1 (1 ## "lux;DataT"
- Text
+ (2 (1 Text (1 TypeList (0))))
(1 ## "lux;VariantT"
TypeList
(1 ## "lux;TupleT"
@@ -279,11 +279,11 @@
(_lux_def Host
(#NamedT ["lux" "Host"]
(#TupleT (#Cons [## "lux;writer"
- (#DataT "org.objectweb.asm.ClassWriter")
+ (#DataT "org.objectweb.asm.ClassWriter" #Nil)
(#Cons [## "lux;loader"
- (#DataT "java.lang.ClassLoader")
+ (#DataT "java.lang.ClassLoader" #Nil)
(#Cons [## "lux;classes"
- (#DataT "clojure.lang.Atom")
+ (#DataT "clojure.lang.Atom" #Nil)
#Nil])])]))))
(_lux_declare-tags [#writer #loader #classes] Host)
@@ -912,14 +912,6 @@
_
(fail "Wrong syntax for @list&")))
-(defmacro' #export (^ tokens)
- (_lux_case tokens
- (#Cons [_ (#SymbolS "" class-name)] #Nil)
- (return (@list (form$ (@list (tag$ ["lux" "DataT"]) (text$ class-name)))))
-
- _
- (fail "Wrong syntax for ^")))
-
(defmacro' #export (, tokens)
(return (@list (form$ (@list (tag$ ["lux" "TupleT"])
(foldL (lambda'' [tail head] (form$ (@list (tag$ ["lux" "Cons"]) head tail)))
@@ -1352,6 +1344,17 @@
(wrap (wrap-meta (form$ (@list (tag$ ["lux" "RecordS"]) (untemplate-list =fields))))))
))
+(defmacro' #export (^ tokens)
+ (_lux_case tokens
+ (#Cons [_ (#SymbolS "" class-name)] #Nil)
+ (return (@list (form$ (@list (tag$ ["lux" "DataT"]) (text$ class-name) (tag$ ["lux" "Nil"])))))
+
+ (#Cons [_ (#SymbolS "" class-name)] params)
+ (return (@list (form$ (@list (tag$ ["lux" "DataT"]) (text$ class-name) (untemplate-list params)))))
+
+ _
+ (fail "Wrong syntax for ^")))
+
(def'' (get-module-name state)
($' Lux Text)
(_lux_case state
@@ -3192,8 +3195,8 @@
(def (type->ast type)
(-> Type AST)
(case type
- (#DataT name)
- (` (#DataT (~ (text$ name))))
+ (#DataT name params)
+ (` (#DataT (~ (text$ name)) (~ (untemplate-list (map type->ast params)))))
(#;VariantT cases)
(` (#VariantT (~ (untemplate-list (map type->ast cases)))))