diff options
Diffstat (limited to 'stdlib/source/lux')
-rw-r--r-- | stdlib/source/lux/control/concatenative.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/lang/compiler/analysis/inference.lux | 16 | ||||
-rw-r--r-- | stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/lang/type.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/lang/type/check.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly.lux | 32 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly/equality.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly/functor.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly/json.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/type/object/interface.lux | 8 |
10 files changed, 45 insertions, 45 deletions
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]) |