aboutsummaryrefslogtreecommitdiff
path: root/source/lux
diff options
context:
space:
mode:
authorEduardo Julian2015-07-26 20:57:21 -0400
committerEduardo Julian2015-07-26 20:57:21 -0400
commit9b7cfd6f5bcc93e2f2f0c3129b7ec6d62c69bb37 (patch)
tree186f2fb0f81589df819c87d37ba4a6f0961ebdc4 /source/lux
parent4cd9b0c9242f1105e50ad9b42b7f6f5d074f14b4 (diff)
- Fixed a pattern-matching error where generalizations of types (universal-quantification / AllT) was not being taken into account properly when destructuring.
- Fixed a compiler error wherein the types of definitions didn't generate (correctly) the structures necessary for storage inside the class _meta(data) field. - Improved both the "open" and "import" macros with extra features.
Diffstat (limited to 'source/lux')
-rw-r--r--source/lux/data/char.lux3
-rw-r--r--source/lux/data/io.lux3
-rw-r--r--source/lux/data/number.lux8
-rw-r--r--source/lux/host/java.lux84
-rw-r--r--source/lux/meta/lux.lux7
-rw-r--r--source/lux/meta/syntax.lux2
6 files changed, 54 insertions, 53 deletions
diff --git a/source/lux/data/char.lux b/source/lux/data/char.lux
index 42e57509e..5dac9a3c7 100644
--- a/source/lux/data/char.lux
+++ b/source/lux/data/char.lux
@@ -8,7 +8,8 @@
(;import lux
(.. (eq #as E)
- (show #as S)))
+ (show #as S)
+ (text #as T #open ("text:" Text/Monoid))))
## [Structures]
(defstruct #export Char/Eq (E;Eq Char)
diff --git a/source/lux/data/io.lux b/source/lux/data/io.lux
index c08023df5..17e8d727a 100644
--- a/source/lux/data/io.lux
+++ b/source/lux/data/io.lux
@@ -10,7 +10,8 @@
(lux/meta macro)
(lux/control (functor #as F)
(monad #as M))
- lux/data/list)
+ (.. list
+ (text #as T #open ("text:" Text/Monoid))))
## Types
(deftype #export (IO a)
diff --git a/source/lux/data/number.lux b/source/lux/data/number.lux
index 8da674d88..b222de15c 100644
--- a/source/lux/data/number.lux
+++ b/source/lux/data/number.lux
@@ -8,10 +8,10 @@
(;import lux
(lux/control (monoid #as m))
- (lux/data (eq #as E)
- (ord #as O)
- (bounded #as B)
- (show #as S)))
+ (.. (eq #as E)
+ (ord #as O)
+ (bounded #as B)
+ (show #as S)))
## Signatures
(defsig #export (Number n)
diff --git a/source/lux/host/java.lux b/source/lux/host/java.lux
index 12525d3f2..9bd0c838c 100644
--- a/source/lux/host/java.lux
+++ b/source/lux/host/java.lux
@@ -10,14 +10,12 @@
(lux (control (monoid #as m)
(functor #as F)
(monad #as M #refer (#only do)))
- (data list
+ (data (list #as l #refer #all #open ("" List/Functor))
(text #as text))
(meta lux
macro
syntax)))
-## (open List/Functor)
-
## [Utils/Parsers]
(def finally^
(Parser Syntax)
@@ -110,29 +108,29 @@
(defsyntax #export (try body [catches (*^ catch^)] [finally (?^ finally^)])
(emit (list (` (_jvm_try (~ body)
- (~@ (list:++ (:: List/Functor (F;map (: (-> (, Text Ident Syntax) Syntax)
- (lambda [catch]
- (let [[class ex body] catch]
- (` (_jvm_catch (~ (text$ class)) (~ (symbol$ ex)) (~ body))))))
- catches))
- (case finally
- #;None
- (list)
-
- (#;Some finally)
- (list (` (_jvm_finally (~ finally))))))))))))
+ (~@ (:: List/Monoid (m;++ (map (: (-> (, Text Ident Syntax) Syntax)
+ (lambda [catch]
+ (let [[class ex body] catch]
+ (` (_jvm_catch (~ (text$ class)) (~ (symbol$ ex)) (~ body))))))
+ catches)
+ (case finally
+ #;None
+ (list)
+
+ (#;Some finally)
+ (list (` (_jvm_finally (~ finally)))))))))))))
(defsyntax #export (definterface [name local-symbol^] [supers (tuple^ (*^ local-symbol^))] [members (*^ method-decl^)])
(do Lux/Monad
[current-module get-module-name
#let [full-name (:: text;Text/Monoid (m;++ (text;replace "/" "." current-module)
name))]]
- (let [members' (:: List/Functor (F;map (: (-> (, (List Text) Text (List Text) Text) Syntax)
- (lambda [member]
- (let [[modifiers name inputs output] member]
- (` ((~ (symbol$ ["" name])) [(~@ (:: List/Functor (F;map text$ inputs)))] (~ (text$ output)) [(~@ (:: List/Functor (F;map text$ modifiers)))])))))
- members))]
- (emit (list (` (_jvm_interface (~ (text$ full-name)) [(~@ (:: List/Functor (F;map text$ supers)))]
+ (let [members' (map (: (-> (, (List Text) Text (List Text) Text) Syntax)
+ (lambda [member]
+ (let [[modifiers name inputs output] member]
+ (` ((~ (symbol$ ["" name])) [(~@ (map text$ inputs))] (~ (text$ output)) [(~@ (map text$ modifiers))])))))
+ members)]
+ (emit (list (` (_jvm_interface (~ (text$ full-name)) [(~@ (map text$ supers))]
(~@ members'))))))))
(defsyntax #export (defclass [name local-symbol^] [super local-symbol^] [interfaces (tuple^ (*^ local-symbol^))]
@@ -142,35 +140,35 @@
[current-module get-module-name
#let [full-name (:: text;Text/Monoid (m;++ (text;replace "/" "." current-module)
name))
- fields' (:: List/Functor (F;map (: (-> (, (List Text) Text Text) Syntax)
- (lambda [field]
- (let [[modifiers name class] field]
- (` ((~ (symbol$ ["" name]))
- (~ (text$ class))
- [(~@ (:: List/Functor (F;map text$ modifiers)))])))))
- fields))
- methods' (:: List/Functor (F;map (: (-> (, (List Text) Text (List (, Text Text)) Text Syntax) Syntax)
- (lambda [methods]
- (let [[modifiers name inputs output body] methods]
- (` ((~ (symbol$ ["" name]))
- [(~@ (:: List/Functor (F;map (: (-> (, Text Text) Syntax)
- (lambda [in]
- (let [[left right] in]
- (form$ (list (text$ left)
- (text$ right))))))
- inputs)))]
- (~ (text$ output))
- [(~@ (:: List/Functor (F;map text$ modifiers)))]
- (~ body))))))
- methods))]]
+ fields' (map (: (-> (, (List Text) Text Text) Syntax)
+ (lambda [field]
+ (let [[modifiers name class] field]
+ (` ((~ (symbol$ ["" name]))
+ (~ (text$ class))
+ [(~@ (map text$ modifiers))])))))
+ fields)
+ methods' (map (: (-> (, (List Text) Text (List (, Text Text)) Text Syntax) Syntax)
+ (lambda [methods]
+ (let [[modifiers name inputs output body] methods]
+ (` ((~ (symbol$ ["" name]))
+ [(~@ (map (: (-> (, Text Text) Syntax)
+ (lambda [in]
+ (let [[left right] in]
+ (form$ (list (text$ left)
+ (text$ right))))))
+ inputs))]
+ (~ (text$ output))
+ [(~@ (map text$ modifiers))]
+ (~ body))))))
+ methods)]]
(emit (list (` (_jvm_class (~ (text$ full-name)) (~ (text$ super))
- [(~@ (:: List/Functor (F;map text$ interfaces)))]
+ [(~@ (map text$ interfaces))]
[(~@ fields')]
[(~@ methods')]))))))
(defsyntax #export (new [class local-symbol^] [arg-classes (tuple^ (*^ local-symbol^))] [args (tuple^ (*^ id^))])
(emit (list (` (_jvm_new (~ (text$ class))
- [(~@ (:: List/Functor (F;map text$ arg-classes)))]
+ [(~@ (map text$ arg-classes))]
[(~@ args)])))))
(defsyntax #export (instance? [class local-symbol^] obj)
diff --git a/source/lux/meta/lux.lux b/source/lux/meta/lux.lux
index a28d6e5d4..99ca200cf 100644
--- a/source/lux/meta/lux.lux
+++ b/source/lux/meta/lux.lux
@@ -14,7 +14,8 @@
(lux/data list
maybe
(show #as S)
- (number #as N)))
+ (number #as N)
+ (text #as T #open ("text:" Text/Monoid Text/Eq))))
## [Types]
## (deftype (Lux a)
@@ -209,10 +210,10 @@
(lambda [b] (let [[label _] b] label))))
(:: List/Functor)
(interpose " ")
- (foldL text:++ ""))))))
+ (foldL text:++ text:unit))))))
(:: List/Functor)
(interpose "\n")
- (foldL text:++ "")))
+ (foldL text:++ text:unit)))
(def (try-both f x1 x2)
(All [a b]
diff --git a/source/lux/meta/syntax.lux b/source/lux/meta/syntax.lux
index 1fe85c32f..83702f75d 100644
--- a/source/lux/meta/syntax.lux
+++ b/source/lux/meta/syntax.lux
@@ -14,7 +14,7 @@
(data (eq #as E)
(bool #as b)
(char #as c)
- (text #as t)
+ (text #as t #open ("text:" Text/Monoid Text/Eq))
list)))
## [Utils]