aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/analyser/base.clj2
-rw-r--r--luxc/src/lux/analyser/case.clj36
-rw-r--r--luxc/src/lux/analyser/lux.clj14
-rw-r--r--luxc/src/lux/analyser/proc/common.clj4
-rw-r--r--luxc/src/lux/analyser/proc/jvm.clj6
-rw-r--r--luxc/src/lux/base.clj2
-rw-r--r--luxc/src/lux/compiler/cache/type.clj6
-rw-r--r--luxc/src/lux/type.clj42
-rw-r--r--luxc/src/lux/type/host.clj4
-rw-r--r--new-luxc/source/luxc/cache/description.lux16
-rw-r--r--stdlib/source/lux.lux100
-rw-r--r--stdlib/source/lux/control/concatenative.lux6
-rw-r--r--stdlib/source/lux/lang/compiler/analysis/inference.lux16
-rw-r--r--stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux8
-rw-r--r--stdlib/source/lux/lang/type.lux8
-rw-r--r--stdlib/source/lux/lang/type/check.lux2
-rw-r--r--stdlib/source/lux/macro/poly.lux32
-rw-r--r--stdlib/source/lux/macro/poly/equality.lux4
-rw-r--r--stdlib/source/lux/macro/poly/functor.lux2
-rw-r--r--stdlib/source/lux/macro/poly/json.lux4
-rw-r--r--stdlib/source/lux/type/object/interface.lux8
-rw-r--r--stdlib/test/test/lux/lang/compiler/analysis/function.lux2
-rw-r--r--stdlib/test/test/lux/lang/compiler/analysis/structure.lux8
23 files changed, 166 insertions, 166 deletions
diff --git a/luxc/src/lux/analyser/base.clj b/luxc/src/lux/analyser/base.clj
index d0c856ffc..5339f8777 100644
--- a/luxc/src/lux/analyser/base.clj
+++ b/luxc/src/lux/analyser/base.clj
@@ -74,7 +74,7 @@
(return ?module))]
(return (&/T [module* ?name]))))
-(let [tag-names #{"Primitive" "Sum" "Product" "Function" "Bound" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"}]
+(let [tag-names #{"Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"}]
(defn type-tag? [module name]
(and (= "lux" module)
(contains? tag-names name))))
diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj
index 2694c9447..d5a6e43cf 100644
--- a/luxc/src/lux/analyser/case.clj
+++ b/luxc/src/lux/analyser/case.clj
@@ -63,40 +63,40 @@
(|let [[_env _idx _var] frame]
(&/T [_env (+ 2 _idx) _var])))
-(defn clean! [level ?tid bound-idx type]
+(defn clean! [level ?tid parameter-idx type]
(|case type
(&/$Var ?id)
(if (= ?tid ?id)
- (&/$Bound (+ (* 2 level) bound-idx))
+ (&/$Parameter (+ (* 2 level) parameter-idx))
type)
(&/$Primitive ?name ?params)
- (&/$Primitive ?name (&/|map (partial clean! level ?tid bound-idx)
+ (&/$Primitive ?name (&/|map (partial clean! level ?tid parameter-idx)
?params))
(&/$Function ?arg ?return)
- (&/$Function (clean! level ?tid bound-idx ?arg)
- (clean! level ?tid bound-idx ?return))
+ (&/$Function (clean! level ?tid parameter-idx ?arg)
+ (clean! level ?tid parameter-idx ?return))
(&/$Apply ?param ?lambda)
- (&/$Apply (clean! level ?tid bound-idx ?param)
- (clean! level ?tid bound-idx ?lambda))
+ (&/$Apply (clean! level ?tid parameter-idx ?param)
+ (clean! level ?tid parameter-idx ?lambda))
(&/$Product ?left ?right)
- (&/$Product (clean! level ?tid bound-idx ?left)
- (clean! level ?tid bound-idx ?right))
+ (&/$Product (clean! level ?tid parameter-idx ?left)
+ (clean! level ?tid parameter-idx ?right))
(&/$Sum ?left ?right)
- (&/$Sum (clean! level ?tid bound-idx ?left)
- (clean! level ?tid bound-idx ?right))
+ (&/$Sum (clean! level ?tid parameter-idx ?left)
+ (clean! level ?tid parameter-idx ?right))
(&/$UnivQ ?env ?body)
- (&/$UnivQ (&/|map (partial clean! level ?tid bound-idx) ?env)
- (clean! (inc level) ?tid bound-idx ?body))
+ (&/$UnivQ (&/|map (partial clean! level ?tid parameter-idx) ?env)
+ (clean! (inc level) ?tid parameter-idx ?body))
(&/$ExQ ?env ?body)
- (&/$ExQ (&/|map (partial clean! level ?tid bound-idx) ?env)
- (clean! (inc level) ?tid bound-idx ?body))
+ (&/$ExQ (&/|map (partial clean! level ?tid parameter-idx) ?env)
+ (clean! (inc level) ?tid parameter-idx ?body))
_
type
@@ -139,10 +139,10 @@
(&/$Function (beta-reduce! level env ?input)
(beta-reduce! level env ?output))
- (&/$Bound ?idx)
+ (&/$Parameter ?idx)
(|case (&/|at (- ?idx (* 2 level)) env)
- (&/$Some bound)
- (beta-reduce! level env bound)
+ (&/$Some parameter)
+ (beta-reduce! level env parameter)
_
type)
diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj
index 781f9854b..35ac72e93 100644
--- a/luxc/src/lux/analyser/lux.clj
+++ b/luxc/src/lux/analyser/lux.clj
@@ -16,7 +16,7 @@
[meta :as &&meta])))
;; [Utils]
-;; TODO: Walk the type to set up the bound-type, instead of doing a
+;; TODO: Walk the type to set up the parameter-type, instead of doing a
;; rough calculation like this one.
(defn ^:private count-univq [type]
"(-> Type Int)"
@@ -29,9 +29,9 @@
;; TODO: This technique will not work if the body of the type contains
;; nested quantifications that cannot be directly counted.
-(defn ^:private next-bound-type [type]
+(defn ^:private next-parameter-type [type]
"(-> Type Type)"
- (&/$Bound (->> (count-univq type) (* 2) (+ 1))))
+ (&/$Parameter (->> (count-univq type) (* 2) (+ 1))))
(defn ^:private embed-inferred-input [input output]
"(-> Type Type Type)"
@@ -75,7 +75,7 @@
=var (&type/resolve-type $var)
inferred-type (|case =var
(&/$Var iid)
- (|do [:let [=var* (next-bound-type tuple-type)]
+ (|do [:let [=var* (next-parameter-type tuple-type)]
_ (&type/set-var iid =var*)
tuple-type* (&type/clean $var tuple-type)]
(return (&/$UnivQ &/$Nil tuple-type*)))
@@ -184,7 +184,7 @@
=var (&type/resolve-type $var)
inferred-type (|case =var
(&/$Var iid)
- (|do [:let [=var* (next-bound-type variant-type)]
+ (|do [:let [=var* (next-parameter-type variant-type)]
_ (&type/set-var iid =var*)
variant-type* (&type/clean $var variant-type)]
(return (&/$UnivQ &/$Nil variant-type*)))
@@ -328,7 +328,7 @@
(|do [? (&type/bound? ?id)
type** (if ?
(&type/clean $var =output-t)
- (|do [_ (&type/set-var ?id (next-bound-type =output-t))
+ (|do [_ (&type/set-var ?id (next-parameter-type =output-t))
cleaned-output* (&type/clean $var =output-t)
:let [cleaned-output (&/$UnivQ &/$Nil cleaned-output*)]]
(return cleaned-output)))
@@ -431,7 +431,7 @@
(defn ^:private clean-func-inference [$input $output =input =func]
(|case =input
(&/$Var iid)
- (|do [:let [=input* (next-bound-type =func)]
+ (|do [:let [=input* (next-parameter-type =func)]
_ (&type/set-var iid =input*)
=func* (&type/clean $input =func)
=func** (&type/clean $output =func*)]
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj
index 0d7b6dd1e..243308799 100644
--- a/luxc/src/lux/analyser/proc/common.clj
+++ b/luxc/src/lux/analyser/proc/common.clj
@@ -260,7 +260,7 @@
(defn ^:private analyse-array-new [analyse exo-type ?values]
(|do [:let [(&/$Cons length (&/$Nil)) ?values]
=length (&&/analyse-1 analyse &type/Nat length)
- _ (&type/check exo-type (&/$UnivQ (&/|list) (&type/Array (&/$Bound 1))))
+ _ (&type/check exo-type (&/$UnivQ (&/|list) (&type/Array (&/$Parameter 1))))
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
(&&/$proc (&/T ["array" "new"]) (&/|list =length) (&/|list)))))))
@@ -382,7 +382,7 @@
(fn [$var]
(|do [:let [(&/$Cons ?init (&/$Nil)) ?values]
=init (&&/analyse-1 analyse $var ?init)
- _ (&type/check exo-type (&/$UnivQ (&/|list) (&type/Box (&/$Bound 1) $var)))
+ _ (&type/check exo-type (&/$UnivQ (&/|list) (&type/Box (&/$Parameter 1) $var)))
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
(&&/$proc (&/T ["box" "new"]) (&/|list =init) (&/|list)))))))))
diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj
index 8ad13c74b..b6d291073 100644
--- a/luxc/src/lux/analyser/proc/jvm.clj
+++ b/luxc/src/lux/analyser/proc/jvm.clj
@@ -84,7 +84,7 @@
(if ?
(|do [real-type (&type/deref id)]
(return (&/T [idx real-type])))
- (return (&/T [(+ 2 idx) (&/$Bound idx)]))))))
+ (return (&/T [(+ 2 idx) (&/$Parameter idx)]))))))
(defn ^:private clean-gtype-vars [gtype-vars]
(|do [[_ clean-types] (&/fold% (fn [idx+types gtype-var]
@@ -99,7 +99,7 @@
"(-> Text (List Type) Type)"
(&/fold (fn [base-type type-arg]
(|case type-arg
- (&/$Bound _)
+ (&/$Parameter _)
(&/$UnivQ &type/empty-env base-type)
_
@@ -204,7 +204,7 @@
(return (&/$Primitive &host-type/array-data-tag (&/|list =param))))
(&/$GenericWildcard _)
- (return (&/$ExQ &/$Nil (&/$Bound 1)))
+ (return (&/$ExQ &/$Nil (&/$Parameter 1)))
))
(defn gen-super-env [class-env supers class-decl]
diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj
index e1f48d23b..1010bf418 100644
--- a/luxc/src/lux/base.clj
+++ b/luxc/src/lux/base.clj
@@ -89,7 +89,7 @@
("Sum" 2)
("Product" 2)
("Function" 2)
- ("Bound" 1)
+ ("Parameter" 1)
("Var" 1)
("Ex" 1)
("UnivQ" 2)
diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj
index 338673807..bf5e04ec6 100644
--- a/luxc/src/lux/compiler/cache/type.clj
+++ b/luxc/src/lux/compiler/cache/type.clj
@@ -41,7 +41,7 @@
(&/$ExQ env body)
(str "E" (serialize-list serialize-type env) (serialize-type body))
- (&/$Bound idx)
+ (&/$Parameter idx)
(str "$" idx stop)
(&/$Ex idx)
@@ -96,7 +96,7 @@
(let [[idx ^String input*] (.split (.substring input 1) stop 2)]
[(<type> (Long/parseLong idx)) input*])))
- ^:private deserialize-bound "$" &/$Bound
+ ^:private deserialize-parameter "$" &/$Parameter
^:private deserialize-ex "!" &/$Ex
^:private deserialize-var "?" &/$Var
)
@@ -133,7 +133,7 @@
(deserialize-prod input)
(deserialize-lambda input)
(deserialize-app input)
- (deserialize-bound input)
+ (deserialize-parameter input)
(deserialize-ex input)
(deserialize-var input)
(deserialize-named input)
diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj
index 3a7b7cc9b..173f144b9 100644
--- a/luxc/src/lux/type.clj
+++ b/luxc/src/lux/type.clj
@@ -25,7 +25,7 @@
(def I64 (&/$Named (&/T ["lux" "I64"])
(&/$UnivQ empty-env
- (&/$Primitive "#I64" (&/|list (&/$Bound 1))))))
+ (&/$Primitive "#I64" (&/|list (&/$Parameter 1))))))
(def Nat* (&/$Primitive &&host/nat-data-tag &/$Nil))
(def Deg* (&/$Primitive &&host/deg-data-tag &/$Nil))
(def Int* (&/$Primitive &&host/int-data-tag &/$Nil))
@@ -56,17 +56,17 @@
(def Nothing
(&/$Named (&/T ["lux" "Nothing"])
(&/$UnivQ empty-env
- (&/$Bound 1))))
+ (&/$Parameter 1))))
(def Any
(&/$Named (&/T ["lux" "Any"])
(&/$ExQ empty-env
- (&/$Bound 1))))
+ (&/$Parameter 1))))
(def IO
(&/$Named (&/T ["lux/codata" "IO"])
(&/$UnivQ empty-env
- (&/$Function Nothing (&/$Bound 1)))))
+ (&/$Function Nothing (&/$Parameter 1)))))
(def List
(&/$Named (&/T ["lux" "List"])
@@ -75,9 +75,9 @@
;; lux;Nil
Any
;; lux;Cons
- (&/$Product (&/$Bound 1)
- (&/$Apply (&/$Bound 1)
- (&/$Bound 0)))))))
+ (&/$Product (&/$Parameter 1)
+ (&/$Apply (&/$Parameter 1)
+ (&/$Parameter 0)))))))
(def Maybe
(&/$Named (&/T ["lux" "Maybe"])
@@ -86,12 +86,12 @@
;; lux;None
Any
;; lux;Some
- (&/$Bound 1))
+ (&/$Parameter 1))
)))
(def Type
(&/$Named (&/T ["lux" "Type"])
- (let [Type (&/$Apply (&/$Bound 1) (&/$Bound 0))
+ (let [Type (&/$Apply (&/$Parameter 1) (&/$Parameter 0))
TypeList (&/$Apply Type List)
TypePair (&/$Product Type Type)]
(&/$Apply Nothing
@@ -109,7 +109,7 @@
;; Function
TypePair
(&/$Sum
- ;; Bound
+ ;; Parameter
Nat
(&/$Sum
;; Var
@@ -138,14 +138,14 @@
(&/$Named (&/T ["lux" "Meta"])
(&/$UnivQ empty-env
(&/$UnivQ empty-env
- (&/$Product (&/$Bound 3)
- (&/$Bound 1))))))
+ (&/$Product (&/$Parameter 3)
+ (&/$Parameter 1))))))
(def Code*
(&/$Named (&/T ["lux" "Code'"])
- (let [Code (&/$Apply (&/$Apply (&/$Bound 1)
- (&/$Bound 0))
- (&/$Bound 1))
+ (let [Code (&/$Apply (&/$Apply (&/$Parameter 1)
+ (&/$Parameter 0))
+ (&/$Parameter 1))
Code-List (&/$Apply Code List)]
(&/$UnivQ empty-env
(&/$Sum ;; "lux;Bool"
@@ -204,7 +204,7 @@
(return* state type)
(&/$None)
- ((&/fail-with-loc (str "[Type Error] Unbound type-var: " id))
+ ((&/fail-with-loc (str "[Type Error] Un-bound type-var: " id))
state))
((&/fail-with-loc (str "[Type Error] Unknown type-var: " id))
state))))
@@ -454,7 +454,7 @@
(&/$Ex ?id)
(str "⟨e:" ?id "⟩")
- (&/$Bound idx)
+ (&/$Parameter idx)
(str idx)
(&/$Apply _ _)
@@ -502,7 +502,7 @@
[(&/$Var xid) (&/$Var yid)]
(= xid yid)
- [(&/$Bound xidx) (&/$Bound yidx)]
+ [(&/$Parameter xidx) (&/$Parameter yidx)]
(= xidx yidx)
[(&/$Ex xid) (&/$Ex yid)]
@@ -597,10 +597,10 @@
(&/$Function ?input ?output)
(&/$Function (beta-reduce env ?input) (beta-reduce env ?output))
- (&/$Bound ?idx)
+ (&/$Parameter ?idx)
(|case (&/|at ?idx env)
- (&/$Some bound)
- (beta-reduce env bound)
+ (&/$Some parameter)
+ (beta-reduce env parameter)
_
(assert false (str "[Type Error] Unknown var: " ?idx " | " (&/->seq (&/|map show-type env)))))
diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj
index bb7459c48..bdf0d7b50 100644
--- a/luxc/src/lux/type/host.clj
+++ b/luxc/src/lux/type/host.clj
@@ -35,7 +35,7 @@
[(&/$Var xid) (&/$Var yid)]
(= xid yid)
- [(&/$Bound xidx) (&/$Bound yidx)]
+ [(&/$Parameter xidx) (&/$Parameter yidx)]
(= xidx yidx)
[(&/$Ex xid) (&/$Ex yid)]
@@ -61,7 +61,7 @@
(def ^:private Any
(&/$Named (&/T ["lux" "Any"])
(&/$ExQ (&/|list)
- (&/$Bound 1))))
+ (&/$Parameter 1))))
;; [Exports]
(def array-data-tag "#Array")
diff --git a/new-luxc/source/luxc/cache/description.lux b/new-luxc/source/luxc/cache/description.lux
index 9ee07c7ad..7706d03b1 100644
--- a/new-luxc/source/luxc/cache/description.lux
+++ b/new-luxc/source/luxc/cache/description.lux
@@ -9,12 +9,12 @@
text/format
(coll [list "list/" Functor<List>]))
(macro [code]
- ["s" syntax #+ Syntax]))
- [///lang])
+ ["s" syntax #+ Syntax])
+ [lang]))
(exception: #export (invalid-lux-version {version Text})
- (format "Expected: " ///lang.version "\n"
- " Actual: " version "\n"))
+ (ex.report ["Expected: " lang.version]
+ [" Actual: " version]))
(def: (write-type type)
(-> Type Code)
@@ -35,7 +35,7 @@
(^template [<tag> <description>]
(<tag> id)
(` (<description> (~ (code.nat id)))))
- ([#.Bound "Bound"]
+ ([#.Parameter "Parameter"]
[#.Var "Var"]
[#.Ex "Ex"])
@@ -71,7 +71,7 @@
(binary "Sum" read-type)
(binary "Product" read-type)
(binary "Function" read-type)
- (indexed "Bound")
+ (indexed "Parameter")
(indexed "Var")
(indexed "Ex")
(quantified "UnivQ" read-type)
@@ -102,7 +102,7 @@
(def: #export (write lux-file module)
(-> Text Module Code)
- (` {"lux version" (~ (code.text ///lang.version))
+ (` {"lux version" (~ (code.text lang.version))
"lux file" (~ (code.text lux-file))
"hash" (~ (code.nat (get@ #.module-hash module)))
"aliases" (~ (write-aliases (get@ #.module-aliases module)))
@@ -123,7 +123,7 @@
(s.record (do p.Monad<Parser>
[lux-version (p.after (s.this (` "lux version")) s.text)
_ (p.assert (ex.construct invalid-lux-version lux-version)
- (text/= ///lang.version lux-version))]
+ (text/= lang.version lux-version))]
($_ p.seq
(p.after (s.this (` "lux file")) s.text)
($_ p.seq
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 31f5165ea..d68ef26ad 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -196,7 +196,7 @@
## (#Sum Type Type)
## (#Product Type Type)
## (#Function Type Type)
-## (#Bound Nat)
+## (#Parameter Nat)
## (#Var Nat)
## (#Ex Nat)
## (#UnivQ (List Type) Type)
@@ -222,7 +222,7 @@
Type-Pair
(+1 ## "lux.Function"
Type-Pair
- (+1 ## "lux.Bound"
+ (+1 ## "lux.Parameter"
Nat
(+1 ## "lux.Var"
Nat
@@ -246,7 +246,7 @@
(#Cons [dummy-cursor (+5 "Sum")]
(#Cons [dummy-cursor (+5 "Product")]
(#Cons [dummy-cursor (+5 "Function")]
- (#Cons [dummy-cursor (+5 "Bound")]
+ (#Cons [dummy-cursor (+5 "Parameter")]
(#Cons [dummy-cursor (+5 "Var")]
(#Cons [dummy-cursor (+5 "Ex")]
(#Cons [dummy-cursor (+5 "UnivQ")]
@@ -288,8 +288,8 @@
(#Named ["lux" "Ann"]
(#UnivQ #Nil
(#UnivQ #Nil
- (#Product (#Bound +3)
- (#Bound +1)))))
+ (#Product (#Parameter +3)
+ (#Parameter +1)))))
[dummy-cursor
(+10 (#Cons [[dummy-cursor (+7 ["lux" "tags"])]
[dummy-cursor (+9 (#Cons [dummy-cursor (+5 "meta")]
@@ -319,9 +319,9 @@
## (#Record (List [(w (Code' w)) (w (Code' w))])))
("lux def" Code'
(#Named ["lux" "Code'"]
- ("lux case" ("lux check type" (#Apply (#Apply (#Bound +1)
- (#Bound +0))
- (#Bound +1)))
+ ("lux case" ("lux check type" (#Apply (#Apply (#Parameter +1)
+ (#Parameter +0))
+ (#Parameter +1)))
{Code
("lux case" ("lux check type" (#Apply Code List))
{Code-List
@@ -486,8 +486,8 @@
(#Product ## "lux.counter"
Nat
## "lux.mappings"
- (#Apply (#Product (#Bound +3)
- (#Bound +1))
+ (#Apply (#Product (#Parameter +3)
+ (#Parameter +1))
List)))))
(record$ (#Cons [(tag$ ["lux" "tags"])
(tuple$ (#Cons (text$ "counter") (#Cons (text$ "mappings") #Nil)))]
@@ -539,9 +539,9 @@
(#UnivQ #Nil
(#UnivQ #Nil
(#Sum ## "lux.Left"
- (#Bound +3)
+ (#Parameter +3)
## "lux.Right"
- (#Bound +1)))))
+ (#Parameter +1)))))
(record$ (#Cons [(tag$ ["lux" "tags"])
(tuple$ (#Cons (text$ "Left") (#Cons (text$ "Right") #Nil)))]
(#Cons [(tag$ ["lux" "type-args"])
@@ -756,7 +756,7 @@
(#Named ["lux" "Meta"]
(#UnivQ #Nil
(#Function Lux
- (#Apply (#Product Lux (#Bound +1))
+ (#Apply (#Product Lux (#Parameter +1))
(#Apply Text Either)))))
(record$ (#Cons [(tag$ ["lux" "doc"])
(text$ "Computations that can have access to the state of the compiler.
@@ -778,10 +778,10 @@
## Base functions & macros
("lux def" return
("lux check" (#UnivQ #Nil
- (#Function (#Bound +1)
+ (#Function (#Parameter +1)
(#Function Lux
(#Apply (#Product Lux
- (#Bound +1))
+ (#Parameter +1))
(#Apply Text Either)))))
("lux function" _ val
("lux function" _ state
@@ -793,7 +793,7 @@
(#Function Text
(#Function Lux
(#Apply (#Product Lux
- (#Bound +1))
+ (#Parameter +1))
(#Apply Text Either)))))
("lux function" _ msg
("lux function" _ state
@@ -1052,9 +1052,9 @@
#Nil
(#UnivQ #Nil
(#UnivQ #Nil
- (#Function (#Function (#Bound +3) (#Bound +1))
- (#Function ($' List (#Bound +3))
- ($' List (#Bound +1))))))
+ (#Function (#Function (#Parameter +3) (#Parameter +1))
+ (#Function ($' List (#Parameter +3))
+ ($' List (#Parameter +1))))))
("lux case" xs
{#Nil
#Nil
@@ -1151,25 +1151,25 @@
("lux coerce" Int subject)
("lux coerce" Int param))))
-(def:'' (update-bounds code)
+(def:'' (update-parameters code)
#Nil
(#Function Code Code)
("lux case" code
{[_ (#Tuple members)]
- (tuple$ (list/map update-bounds members))
+ (tuple$ (list/map update-parameters members))
[_ (#Record pairs)]
(record$ (list/map ("lux check" (#Function (#Product Code Code) (#Product Code Code))
(function'' [pair]
(let'' [name val] pair
- [name (update-bounds val)])))
+ [name (update-parameters val)])))
pairs))
- [_ (#Form (#Cons [_ (#Tag "lux" "Bound")] (#Cons [_ (#Nat idx)] #Nil)))]
- (form$ (#Cons (tag$ ["lux" "Bound"]) (#Cons (nat$ (n/+ +2 idx)) #Nil)))
+ [_ (#Form (#Cons [_ (#Tag "lux" "Parameter")] (#Cons [_ (#Nat idx)] #Nil)))]
+ (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ (n/+ +2 idx)) #Nil)))
[_ (#Form members)]
- (form$ (list/map update-bounds members))
+ (form$ (list/map update-parameters members))
_
code}))
@@ -1192,20 +1192,20 @@
(fail "Expected symbol.")}
))
-(def:'' (make-bound idx)
+(def:'' (make-parameter idx)
#Nil
(#Function Nat Code)
- (form$ (#Cons (tag$ ["lux" "Bound"]) (#Cons (nat$ idx) #Nil))))
+ (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ idx) #Nil))))
(def:'' (list/fold f init xs)
#Nil
## (All [a b] (-> (-> b a a) a (List b) a))
- (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Bound +1)
- (#Function (#Bound +3)
- (#Bound +3)))
- (#Function (#Bound +3)
- (#Function ($' List (#Bound +1))
- (#Bound +3))))))
+ (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter +1)
+ (#Function (#Parameter +3)
+ (#Parameter +3)))
+ (#Function (#Parameter +3)
+ (#Function ($' List (#Parameter +1))
+ (#Parameter +3))))))
("lux case" xs
{#Nil
init
@@ -1216,7 +1216,7 @@
(def:'' (list/size list)
#Nil
(#UnivQ #Nil
- (#Function ($' List (#Bound +1)) Nat))
+ (#Function ($' List (#Parameter +1)) Nat))
(list/fold (function'' [_ acc] (n/+ +1 acc)) +0 list))
(macro:' #export (All tokens)
@@ -1244,8 +1244,8 @@
(function'' [name' body']
(form$ (#Cons (tag$ ["lux" "UnivQ"])
(#Cons (tag$ ["lux" "Nil"])
- (#Cons (replace-syntax (#Cons [name' (make-bound +1)] #Nil)
- (update-bounds body')) #Nil))))))
+ (#Cons (replace-syntax (#Cons [name' (make-parameter +1)] #Nil)
+ (update-parameters body')) #Nil))))))
body
names)
(return (#Cons ("lux case" [(text/= "" self-name) names]
@@ -1256,7 +1256,7 @@
body'
[false _]
- (replace-syntax (#Cons [self-name (make-bound (n/* +2 (n/- +1 (list/size names))))]
+ (replace-syntax (#Cons [self-name (make-parameter (n/* +2 (n/- +1 (list/size names))))]
#Nil)
body')})
#Nil)))))
@@ -1292,8 +1292,8 @@
(function'' [name' body']
(form$ (#Cons (tag$ ["lux" "ExQ"])
(#Cons (tag$ ["lux" "Nil"])
- (#Cons (replace-syntax (#Cons [name' (make-bound +1)] #Nil)
- (update-bounds body')) #Nil))))))
+ (#Cons (replace-syntax (#Cons [name' (make-parameter +1)] #Nil)
+ (update-parameters body')) #Nil))))))
body
names)
(return (#Cons ("lux case" [(text/= "" self-name) names]
@@ -1304,7 +1304,7 @@
body'
[false _]
- (replace-syntax (#Cons [self-name (make-bound (n/* +2 (n/- +1 (list/size names))))]
+ (replace-syntax (#Cons [self-name (make-parameter (n/* +2 (n/- +1 (list/size names))))]
#Nil)
body')})
#Nil)))))
@@ -2964,8 +2964,8 @@
[Int (List Self)])")])
("lux case" tokens
{(#Cons [_ (#Symbol "" name)] (#Cons body #Nil))
- (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-bound +1)) (~ (make-bound +0))))])
- (update-bounds body))]
+ (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter +1)) (~ (make-parameter +0))))])
+ (update-parameters body))]
(return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body')))))))
_
@@ -3698,10 +3698,10 @@
(#Function ?input ?output)
(#Function (beta-reduce env ?input) (beta-reduce env ?output))
- (#Bound idx)
+ (#Parameter idx)
(case (nth idx env)
- (#Some bound)
- bound
+ (#Some parameter)
+ parameter
_
type)
@@ -4576,7 +4576,7 @@
(#Function _)
($_ text/compose "(-> " (|> (flatten-lambda type) (list/map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")")
- (#Bound id)
+ (#Parameter id)
(nat/encode id)
(#Var id)
@@ -5219,7 +5219,7 @@
([#.UnivQ]
[#.ExQ])
- (#.Bound idx)
+ (#.Parameter idx)
(default type (list.nth idx env))
_
@@ -5468,8 +5468,8 @@
(#Function in out)
(` (#Function (~ (type-to-code in)) (~ (type-to-code out))))
- (#Bound idx)
- (` (#Bound (~ (nat$ idx))))
+ (#Parameter idx)
+ (` (#Parameter (~ (nat$ idx))))
(#Var id)
(` (#Var (~ (nat$ id))))
@@ -5627,7 +5627,7 @@
(macro: #export (with-expansions tokens)
{#.doc (doc "Controlled macro-expansion."
"Bind an arbitraty number of Codes resulting from macro-expansion to local bindings."
- "Wherever a binding appears, the bound Codes will be spliced in there."
+ "Wherever a binding appears, the bound codes will be spliced in there."
(test: "Code operations & structures"
(with-expansions
[<tests> (do-template [<expr> <text> <pattern>]
diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux
index 2b91cac0e..70756c5c6 100644
--- a/stdlib/source/lux/control/concatenative.lux
+++ b/stdlib/source/lux/control/concatenative.lux
@@ -32,7 +32,7 @@
(def: bottom^
(s.Syntax Nat)
- (s.form (p.after (s.this (` #.Bound)) s.nat)))
+ (s.form (p.after (s.this (` #.Parameter)) s.nat)))
(def: stack^
(s.Syntax Stack)
@@ -68,8 +68,8 @@
(code.replace (code.local-symbol from) to pre))
aliased
aliases))]
- (case [(|> inputs (get@ #bottom) (maybe/map (|>> code.nat (~) #.Bound (`))))
- (|> outputs (get@ #bottom) (maybe/map (|>> code.nat (~) #.Bound (`))))]
+ (case [(|> inputs (get@ #bottom) (maybe/map (|>> code.nat (~) #.Parameter (`))))
+ (|> outputs (get@ #bottom) (maybe/map (|>> code.nat (~) #.Parameter (`))))]
[(#.Some bottomI) (#.Some bottomO)]
(monad.do @
[inputC (singleton (macro.expand-all (stack-fold (get@ #top inputs) bottomI)))
diff --git a/stdlib/source/lux/lang/compiler/analysis/inference.lux b/stdlib/source/lux/lang/compiler/analysis/inference.lux
index 5e3fb0cfe..42ab27a6c 100644
--- a/stdlib/source/lux/lang/compiler/analysis/inference.lux
+++ b/stdlib/source/lux/lang/compiler/analysis/inference.lux
@@ -43,30 +43,30 @@
[invalid-type-application]
)
-(def: (replace bound-idx replacement type)
+(def: (replace parameter-idx replacement type)
(-> Nat Type Type Type)
(case type
(#.Primitive name params)
- (#.Primitive name (list/map (replace bound-idx replacement) params))
+ (#.Primitive name (list/map (replace parameter-idx replacement) params))
(^template [<tag>]
(<tag> left right)
- (<tag> (replace bound-idx replacement left)
- (replace bound-idx replacement right)))
+ (<tag> (replace parameter-idx replacement left)
+ (replace parameter-idx replacement right)))
([#.Sum]
[#.Product]
[#.Function]
[#.Apply])
- (#.Bound idx)
- (if (n/= bound-idx idx)
+ (#.Parameter idx)
+ (if (n/= parameter-idx idx)
replacement
type)
(^template [<tag>]
(<tag> env quantified)
- (<tag> (list/map (replace bound-idx replacement) env)
- (replace (n/+ +2 bound-idx) replacement quantified)))
+ (<tag> (list/map (replace parameter-idx replacement) env)
+ (replace (n/+ +2 parameter-idx) replacement quantified)))
([#.UnivQ]
[#.ExQ])
diff --git a/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux
index 2de55b223..9b742b415 100644
--- a/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux
+++ b/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux
@@ -597,7 +597,7 @@
arity
(|> (list.n/range +0 (dec arity))
list.reverse
- (list/map (|>> (n/* +2) inc #.Bound))
+ (list/map (|>> (n/* +2) inc #.Parameter))
(#.Primitive class-name)
(type.univ-q arity)))))
@@ -959,16 +959,16 @@
true
(list.zip2 arg-classes parameters))))))
-(def: idx-to-bound
+(def: idx-to-parameter
(-> Nat Type)
- (|>> (n/* +2) inc #.Bound))
+ (|>> (n/* +2) inc #.Parameter))
(def: (type-vars amount offset)
(-> Nat Nat (List Type))
(if (n/= +0 amount)
(list)
(|> (list.n/range offset (|> amount dec (n/+ offset)))
- (list/map idx-to-bound))))
+ (list/map idx-to-parameter))))
(def: (method-to-type method-style method)
(-> Method-style Method (Meta [Type (List Type)]))
diff --git a/stdlib/source/lux/lang/type.lux b/stdlib/source/lux/lang/type.lux
index acc3d9046..cd18e103d 100644
--- a/stdlib/source/lux/lang/type.lux
+++ b/stdlib/source/lux/lang/type.lux
@@ -37,7 +37,7 @@
([#.UnivQ]
[#.ExQ])
- (#.Bound idx)
+ (#.Parameter idx)
(maybe.default (error! (text/compose "Unknown type var: " (nat/encode idx)))
(list.nth idx env))
@@ -59,7 +59,7 @@
(^template [<tag>]
[(<tag> xid) (<tag> yid)]
(n/= yid xid))
- ([#.Var] [#.Ex] [#.Bound])
+ ([#.Var] [#.Ex] [#.Parameter])
(^or [(#.Function xleft xright) (#.Function yleft yright)]
[(#.Apply xleft xright) (#.Apply yleft yright)])
@@ -172,7 +172,7 @@
(^template [<tag>]
(<tag> idx)
(` (<tag> (~ (code.nat idx)))))
- ([#.Var] [#.Ex] [#.Bound])
+ ([#.Var] [#.Ex] [#.Parameter])
(^template [<tag>]
(<tag> left right)
@@ -223,7 +223,7 @@
(list/fold text/compose ""))
" " (to-text out) ")"))
- (#.Bound idx)
+ (#.Parameter idx)
(nat/encode idx)
(#.Var id)
diff --git a/stdlib/source/lux/lang/type/check.lux b/stdlib/source/lux/lang/type/check.lux
index 2e255d47c..482ea66bf 100644
--- a/stdlib/source/lux/lang/type/check.lux
+++ b/stdlib/source/lux/lang/type/check.lux
@@ -651,7 +651,7 @@
[paramsT+' (monad.map @ clean paramsT+)]
(wrap (#.Primitive name paramsT+')))
- (^or (#.Bound _) (#.Ex _) (#.Named _))
+ (^or (#.Parameter _) (#.Ex _) (#.Named _))
(:: Monad<Check> wrap inputT)
(^template [<tag>]
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index 39c3ffbbb..2eb2e9ebc 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -155,7 +155,7 @@
(recur (inc current-arg)
(|> env'
(dict.put funcI [headT funcL])
- (dict.put (inc funcI) [(#.Bound (inc funcI)) varL]))
+ (dict.put (inc funcI) [(#.Parameter (inc funcI)) varL]))
(#.Cons varL all-varsL)))
(let [partialI (|> current-arg (n/* +2) (n/+ funcI))
partial-varI (inc partialI)
@@ -166,7 +166,7 @@
(recur (inc current-arg)
(|> env'
(dict.put partialI [.Nothing partialC])
- (dict.put partial-varI [(#.Bound partial-varI) partial-varL]))
+ (dict.put partial-varI [(#.Parameter partial-varI) partial-varL]))
(#.Cons partial-varL all-varsL))))
[all-varsL env']))]]
(|> (do @
@@ -213,26 +213,26 @@
(def: (adjusted-idx env idx)
(-> Env Nat Nat)
(let [env-level (n// +2 (dict.size env))
- bound-level (n// +2 idx)
- bound-idx (n/% +2 idx)]
- (|> env-level dec (n/- bound-level) (n/* +2) (n/+ bound-idx))))
+ parameter-level (n// +2 idx)
+ parameter-idx (n/% +2 idx)]
+ (|> env-level dec (n/- parameter-level) (n/* +2) (n/+ parameter-idx))))
-(def: #export bound
+(def: #export parameter
(Poly Code)
(do p.Monad<Parser>
[env ..env
headT any]
(case headT
- (#.Bound idx)
+ (#.Parameter idx)
(case (dict.get (adjusted-idx env idx) env)
(#.Some [poly-type poly-code])
(wrap poly-code)
#.None
- (p.fail ($_ text/compose "Unknown bound type: " (type.to-text headT))))
+ (p.fail ($_ text/compose "Unknown parameter type: " (type.to-text headT))))
_
- (p.fail ($_ text/compose "Not a bound type: " (type.to-text headT))))))
+ (p.fail ($_ text/compose "Not a parameter type: " (type.to-text headT))))))
(def: #export (var id)
(-> Nat (Poly Any))
@@ -240,15 +240,15 @@
[env ..env
headT any]
(case headT
- (#.Bound idx)
+ (#.Parameter idx)
(if (n/= id (adjusted-idx env idx))
(wrap [])
- (p.fail ($_ text/compose "Wrong bound type.\n"
+ (p.fail ($_ text/compose "Wrong parameter type.\n"
"Expected: " (nat/encode id) "\n"
" Actual: " (nat/encode idx))))
_
- (p.fail ($_ text/compose "Not a bound type: " (type.to-text headT))))))
+ (p.fail ($_ text/compose "Not a parameter type: " (type.to-text headT))))))
(exception: #export (not-existential-type {type Type})
(type.to-text type))
@@ -297,7 +297,7 @@
[env ..env
headT any]
(case (type.un-name headT)
- (^multi (#.Apply (#.Named ["lux" "Nothing"] _) (#.Bound funcT-idx))
+ (^multi (#.Apply (#.Named ["lux" "Nothing"] _) (#.Parameter funcT-idx))
(n/= +0 (adjusted-idx env funcT-idx))
[(dict.get +0 env) (#.Some [self-type self-call])])
(wrap self-call)
@@ -313,7 +313,7 @@
_ (local (list funcT) (var +0))
allC (let [allT (list& funcT argsT)]
(|> allT
- (monad.map @ (function.constant bound))
+ (monad.map @ (function.constant parameter))
(local allT)))]
(wrap (` ((~+ allC))))))
@@ -398,13 +398,13 @@
(` (<tag> (~ (code.nat idx)))))
([#.Var] [#.Ex])
- (#.Bound idx)
+ (#.Parameter idx)
(let [idx (adjusted-idx env idx)]
(if (n/= +0 idx)
(|> (dict.get idx env) maybe.assume product.left (to-code env))
(` (.$ (~ (code.nat (dec idx)))))))
- (#.Apply (#.Named ["lux" "Nothing"] _) (#.Bound idx))
+ (#.Apply (#.Named ["lux" "Nothing"] _) (#.Parameter idx))
(let [idx (adjusted-idx env idx)]
(if (n/= +0 idx)
(|> (dict.get idx env) maybe.assume product.left (to-code env))
diff --git a/stdlib/source/lux/macro/poly/equality.lux b/stdlib/source/lux/macro/poly/equality.lux
index bdf70d622..c834509d8 100644
--- a/stdlib/source/lux/macro/poly/equality.lux
+++ b/stdlib/source/lux/macro/poly/equality.lux
@@ -132,8 +132,8 @@
(do @
[[funcC argsC] (poly.apply (p.seq Eq<?> (p.many Eq<?>)))]
(wrap (` ((~ funcC) (~+ argsC)))))
- ## Bound type-vars
- poly.bound
+ ## Parameters
+ poly.parameter
## Polymorphism
(do @
[[funcC varsC bodyC] (poly.polymorphic Eq<?>)]
diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux
index 525b292c7..bf9421cde 100644
--- a/stdlib/source/lux/macro/poly/functor.lux
+++ b/stdlib/source/lux/macro/poly/functor.lux
@@ -82,7 +82,7 @@
(do p.Monad<Parser>
[_ poly.recursive-call]
(wrap (` ((~' map) (~ funcC) (~ valueC)))))
- ## Bound type-variables
+ ## Parameters
(do p.Monad<Parser>
[_ poly.any]
(wrap valueC))
diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux
index ba8512835..dac1874e9 100644
--- a/stdlib/source/lux/macro/poly/json.lux
+++ b/stdlib/source/lux/macro/poly/json.lux
@@ -189,7 +189,7 @@
//.JSON)))
(function ((~ funcC) (~+ varsC))
(~ bodyC))))))
- poly.bound
+ poly.parameter
poly.recursive-call
## If all else fails...
(p.fail (format "Cannot create JSON encoder for: " (type.to-text inputT)))
@@ -284,7 +284,7 @@
(//.Reader ((~ (poly.to-code *env* inputT)) (~+ varsC)))))
(function ((~ funcC) (~+ varsC))
(~ bodyC))))))
- poly.bound
+ poly.parameter
poly.recursive-call
## If all else fails...
(p.fail (format "Cannot create JSON decoder for: " (type.to-text inputT)))
diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux
index 393fa929f..e4b08c9ac 100644
--- a/stdlib/source/lux/type/object/interface.lux
+++ b/stdlib/source/lux/type/object/interface.lux
@@ -184,10 +184,10 @@
size
(|> (dec size)
(list.n/range +0)
- (list/map (|>> (n/* +2) inc code.nat (~) #.Bound (`)))
+ (list/map (|>> (n/* +2) inc code.nat (~) #.Parameter (`)))
(list.zip2 (list.reverse mappings))
- (list/fold (function (_ [mappingC boundC] genericC)
- (code.replace boundC mappingC genericC))
+ (list/fold (function (_ [mappingC parameterC] genericC)
+ (code.replace parameterC mappingC genericC))
typeC))))
(def: referenceS
@@ -335,7 +335,7 @@
(^template [<tag>]
(<tag> idx)
(meta/wrap (` (<tag> (~ (code.nat idx))))))
- ([#.Bound]
+ ([#.Parameter]
[#.Var]
[#.Ex])
diff --git a/stdlib/test/test/lux/lang/compiler/analysis/function.lux b/stdlib/test/test/lux/lang/compiler/analysis/function.lux
index 33bae5c9b..3fab96a92 100644
--- a/stdlib/test/test/lux/lang/compiler/analysis/function.lux
+++ b/stdlib/test/test/lux/lang/compiler/analysis/function.lux
@@ -79,7 +79,7 @@
[outputT outputC] _primitive.primitive
#let [funcT (type.function inputsT outputT)
partialT (type.function (list.drop partial-args inputsT) outputT)
- varT (#.Bound +1)
+ varT (#.Parameter +1)
polyT (<| (type.univ-q +1)
(type.function (list.concat (list (list.take var-idx inputsT)
(list varT)
diff --git a/stdlib/test/test/lux/lang/compiler/analysis/structure.lux b/stdlib/test/test/lux/lang/compiler/analysis/structure.lux
index 1ad28e16b..2342e0e5a 100644
--- a/stdlib/test/test/lux/lang/compiler/analysis/structure.lux
+++ b/stdlib/test/test/lux/lang/compiler/analysis/structure.lux
@@ -112,7 +112,7 @@
[valueT valueC] (maybe.assume (list.nth choice primitives))
+size (inc size)
+primitives (list.concat (list (list.take choice primitives)
- (list [(#.Bound +1) +valueC])
+ (list [(#.Parameter +1) +valueC])
(list.drop choice primitives)))
[+valueT +valueC] (maybe.assume (list.nth +choice +primitives))
+variantT (type.variant (list/map product.left +primitives))]]
@@ -164,7 +164,7 @@
#let [tupleT (type.tuple (list/map product.left primitives))
[singletonT singletonC] (|> primitives (list.nth choice) maybe.assume)
+primitives (list.concat (list (list.take choice primitives)
- (list [(#.Bound +1) +valueC])
+ (list [(#.Parameter +1) +valueC])
(list.drop choice primitives)))
+tupleT (type.tuple (list/map product.left +primitives))]]
($_ seq
@@ -224,7 +224,7 @@
primitives (r.list size _primitive.primitive)
module-name (r.unicode +5)
type-name (r.unicode +5)
- #let [varT (#.Bound +1)
+ #let [varT (#.Parameter +1)
primitivesT (list/map product.left primitives)
[choiceT choiceC] (maybe.assume (list.nth choice primitives))
[other-choiceT other-choiceC] (maybe.assume (list.nth other-choice primitives))
@@ -262,7 +262,7 @@
module-name (r.unicode +5)
type-name (r.unicode +5)
choice (|> r.nat (:: @ map (n/% size)))
- #let [varT (#.Bound +1)
+ #let [varT (#.Parameter +1)
tagsC (list/map (|>> [module-name] code.tag) tags)
primitivesT (list/map product.left primitives)
primitivesC (list/map product.right primitives)