diff options
author | Eduardo Julian | 2017-04-10 23:21:35 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-04-10 23:21:35 -0400 |
commit | a1b2a8120921ccca79e95b8bd35b475b34dd9780 (patch) | |
tree | 721634e556f66d3d8afcae181320c503c3b708df | |
parent | 6066515f7a9736210a04652636a634179939d185 (diff) |
- Renamed "LambdaT" to "FunctionT".
-rw-r--r-- | luxc/src/lux/analyser/base.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/analyser/case.clj | 12 | ||||
-rw-r--r-- | luxc/src/lux/analyser/lux.clj | 8 | ||||
-rw-r--r-- | luxc/src/lux/base.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache/type.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/host.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/type.clj | 20 | ||||
-rw-r--r-- | stdlib/source/lux.lux | 138 | ||||
-rw-r--r-- | stdlib/source/lux/host.jvm.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/type.lux | 12 | ||||
-rw-r--r-- | stdlib/source/lux/type/auto.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/type/check.lux | 4 | ||||
-rw-r--r-- | stdlib/test/test/lux/type.lux | 2 | ||||
-rw-r--r-- | stdlib/test/test/lux/type/check.lux | 10 |
15 files changed, 114 insertions, 114 deletions
diff --git a/luxc/src/lux/analyser/base.clj b/luxc/src/lux/analyser/base.clj index 46eafa051..cbcb71933 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 #{"HostT" "VoidT" "UnitT" "SumT" "ProdT" "LambdaT" "BoundT" "VarT" "ExT" "UnivQ" "ExQ" "AppT" "NamedT"}] +(let [tag-names #{"HostT" "VoidT" "UnitT" "SumT" "ProdT" "FunctionT" "BoundT" "VarT" "ExT" "UnivQ" "ExQ" "AppT" "NamedT"}] (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 5b25115ea..2f3a4d575 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -74,9 +74,9 @@ (&/$HostT ?name (&/|map (partial clean! level ?tid bound-idx) ?params)) - (&/$LambdaT ?arg ?return) - (&/$LambdaT (clean! level ?tid bound-idx ?arg) - (clean! level ?tid bound-idx ?return)) + (&/$FunctionT ?arg ?return) + (&/$FunctionT (clean! level ?tid bound-idx ?arg) + (clean! level ?tid bound-idx ?return)) (&/$AppT ?lambda ?param) (&/$AppT (clean! level ?tid bound-idx ?lambda) @@ -135,9 +135,9 @@ _ type) - (&/$LambdaT ?input ?output) - (&/$LambdaT (beta-reduce! level env ?input) - (beta-reduce! level env ?output)) + (&/$FunctionT ?input ?output) + (&/$FunctionT (beta-reduce! level env ?input) + (beta-reduce! level env ?output)) (&/$BoundT ?idx) (|case (&/|at (- ?idx (* 2 level)) env) diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index 04ef66683..16ba17583 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -40,7 +40,7 @@ (&/$UnivQ env (embed-inferred-input input output*)) _ - (&/$LambdaT input output))) + (&/$FunctionT input output))) ;; [Exports] (defn analyse-unit [analyse ?exo-type] @@ -354,7 +354,7 @@ type* (&type/apply-type ?fun-type* $var)] (analyse-apply* analyse exo-type type* ?args)) - (&/$LambdaT ?input-t ?output-t) + (&/$FunctionT ?input-t ?output-t) (|do [[=output-t =args] (analyse-apply* analyse exo-type ?output-t ?args*) =arg (&/with-attempt (&&/analyse-1 analyse ?input-t ?arg) @@ -476,7 +476,7 @@ (fn [$input] (&type/with-var (fn [$output] - (|do [[[function-type function-cursor] function-analysis] (analyse-function* analyse (&/$LambdaT $input $output) ?self ?arg ?body) + (|do [[[function-type function-cursor] function-analysis] (analyse-function* analyse (&/$FunctionT $input $output) ?self ?arg ?body) =input (&type/resolve-type $input) =output (&type/resolve-type $output) inferred-type (clean-func-inference $input $output =input (embed-inferred-input =input =output)) @@ -503,7 +503,7 @@ =expr (analyse-function* analyse exo-type** ?self ?arg ?body)] (&&/clean-analysis $var =expr)))) - (&/$LambdaT ?arg-t ?return-t) + (&/$FunctionT ?arg-t ?return-t) (|do [[=scope =captured =body] (&&function/with-function ?self exo-type* ?arg ?arg-t (&&/analyse-1 analyse ?return-t ?body)) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index da6dcbf0a..2fe9952ee 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -91,7 +91,7 @@ ("UnitT" 0) ("SumT" 2) ("ProdT" 2) - ("LambdaT" 2) + ("FunctionT" 2) ("BoundT" 1) ("VarT" 1) ("ExT" 1) diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj index 26a08e193..5715866f7 100644 --- a/luxc/src/lux/compiler/cache/type.clj +++ b/luxc/src/lux/compiler/cache/type.clj @@ -39,7 +39,7 @@ (&/$SumT left right) (str "+" (serialize-type left) (serialize-type right)) - (&/$LambdaT left right) + (&/$FunctionT left right) (str ">" (serialize-type left) (serialize-type right)) (&/$UnivQ env body) @@ -100,7 +100,7 @@ ^:private deserialize-sum "+" &/$SumT ^:private deserialize-prod "*" &/$ProdT - ^:private deserialize-lambda ">" &/$LambdaT + ^:private deserialize-lambda ">" &/$FunctionT ^:private deserialize-app "%" &/$AppT ) diff --git a/luxc/src/lux/host.clj b/luxc/src/lux/host.clj index f0b45723d..e222baf10 100644 --- a/luxc/src/lux/host.clj +++ b/luxc/src/lux/host.clj @@ -55,7 +55,7 @@ (= &host-type/null-data-tag ?name) (return (&host-generics/->type-signature "java.lang.Object")) :else (return (&host-generics/->type-signature ?name))) - (&/$LambdaT _ _) + (&/$FunctionT _ _) (return (&host-generics/->type-signature function-class)) (&/$UnitT) diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj index 47b4b9c38..561d81795 100644 --- a/luxc/src/lux/type.clj +++ b/luxc/src/lux/type.clj @@ -53,7 +53,7 @@ (def IO (&/$NamedT (&/T ["lux/codata" "IO"]) (&/$UnivQ empty-env - (&/$LambdaT &/$VoidT (&/$BoundT 1))))) + (&/$FunctionT &/$VoidT (&/$BoundT 1))))) (def List (&/$NamedT (&/T ["lux" "List"]) @@ -98,7 +98,7 @@ ;; ProdT TypePair (&/$SumT - ;; LambdaT + ;; FunctionT TypePair (&/$SumT ;; BoundT @@ -335,10 +335,10 @@ (|do [=params (&/map% (partial clean* ?tid) ?params)] (return (&/$HostT ?name =params))) - (&/$LambdaT ?arg ?return) + (&/$FunctionT ?arg ?return) (|do [=arg (clean* ?tid ?arg) =return (clean* ?tid ?return)] - (return (&/$LambdaT =arg =return))) + (return (&/$FunctionT =arg =return))) (&/$AppT ?lambda ?param) (|do [=lambda (clean* ?tid ?lambda) @@ -379,7 +379,7 @@ (defn ^:private unravel-fun [type] (|case type - (&/$LambdaT ?in ?out) + (&/$FunctionT ?in ?out) (|let [[??out ?args] (unravel-fun ?out)] (&/T [??out (&/$Cons ?in ?args)])) @@ -462,7 +462,7 @@ (&/$SumT _) (str "(| " (->> (flatten-sum type) (&/|map show-type) (&/|interpose " ") (&/fold str "")) ")") - (&/$LambdaT input output) + (&/$FunctionT input output) (|let [[?out ?ins] (unravel-fun type)] (str "(-> " (->> ?ins (&/|map show-type) (&/|interpose " ") (&/fold str "")) " " (show-type ?out) ")")) @@ -519,7 +519,7 @@ (and (type= xL yL) (type= xR yR)) - [(&/$LambdaT xinput xoutput) (&/$LambdaT yinput youtput)] + [(&/$FunctionT xinput xoutput) (&/$FunctionT yinput youtput)] (and (type= xinput yinput) (type= xoutput youtput)) @@ -618,8 +618,8 @@ _ type) - (&/$LambdaT ?input ?output) - (&/$LambdaT (beta-reduce env ?input) (beta-reduce env ?output)) + (&/$FunctionT ?input ?output) + (&/$FunctionT (beta-reduce env ?input) (beta-reduce env ?output)) (&/$BoundT ?idx) (|case (&/|at ?idx env) @@ -852,7 +852,7 @@ [(&/$UnitT) (&/$UnitT)] (return fixpoints) - [(&/$LambdaT eI eO) (&/$LambdaT aI aO)] + [(&/$FunctionT eI eO) (&/$FunctionT aI aO)] (|do [fixpoints* (check* fixpoints invariant?? aI eI)] (check* fixpoints* invariant?? eO aO)) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index bb66813cc..1307231e2 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -126,7 +126,7 @@ ## #UnitT ## (#SumT Type Type) ## (#ProdT Type Type) -## (#LambdaT Type Type) +## (#FunctionT Type Type) ## (#BoundT Nat) ## (#VarT Nat) ## (#ExT Nat) @@ -154,7 +154,7 @@ TypePair (+3 ## "lux;ProdT" TypePair - (+3 ## "lux;LambdaT" + (+3 ## "lux;FunctionT" TypePair (+3 ## "lux;BoundT" Nat @@ -178,7 +178,7 @@ (#Cons (+6 "UnitT") (#Cons (+6 "SumT") (#Cons (+6 "ProdT") - (#Cons (+6 "LambdaT") + (#Cons (+6 "FunctionT") (#Cons (+6 "BoundT") (#Cons (+6 "VarT") (#Cons (+6 "ExT") @@ -650,9 +650,9 @@ (_lux_def Lux (#NamedT ["lux" "Lux"] (#UnivQ #Nil - (#LambdaT Compiler - (#AppT (#AppT Either Text) - (#ProdT Compiler (#BoundT +1)))))) + (#FunctionT Compiler + (#AppT (#AppT Either Text) + (#ProdT Compiler (#BoundT +1)))))) (#Cons [["lux" "doc"] (#TextA "Computations that can have access to the state of the compiler. These computations may fail, or modify the state of the compiler.")] @@ -663,7 +663,7 @@ ## (-> (List AST) (Lux (List AST)))) (_lux_def Macro (#NamedT ["lux" "Macro"] - (#LambdaT ASTList (#AppT Lux ASTList))) + (#FunctionT ASTList (#AppT Lux ASTList))) (#Cons [["lux" "doc"] (#TextA "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")] default-def-meta-exported)) @@ -673,20 +673,20 @@ #Nil) (_lux_def _meta - (_lux_: (#LambdaT (#AppT AST' - (#AppT Meta Cursor)) - AST) + (_lux_: (#FunctionT (#AppT AST' + (#AppT Meta Cursor)) + AST) (_lux_function _ data [_cursor data])) #Nil) (_lux_def return (_lux_: (#UnivQ #Nil - (#LambdaT (#BoundT +1) - (#LambdaT Compiler - (#AppT (#AppT Either Text) - (#ProdT Compiler - (#BoundT +1)))))) + (#FunctionT (#BoundT +1) + (#FunctionT Compiler + (#AppT (#AppT Either Text) + (#ProdT Compiler + (#BoundT +1)))))) (_lux_function _ val (_lux_function _ state (#Right state val)))) @@ -694,73 +694,73 @@ (_lux_def fail (_lux_: (#UnivQ #Nil - (#LambdaT Text - (#LambdaT Compiler - (#AppT (#AppT Either Text) - (#ProdT Compiler - (#BoundT +1)))))) + (#FunctionT Text + (#FunctionT Compiler + (#AppT (#AppT Either Text) + (#ProdT Compiler + (#BoundT +1)))))) (_lux_function _ msg (_lux_function _ state (#Left msg)))) #Nil) (_lux_def bool$ - (_lux_: (#LambdaT Bool AST) + (_lux_: (#FunctionT Bool AST) (_lux_function _ value (_meta (#BoolS value)))) #Nil) (_lux_def nat$ - (_lux_: (#LambdaT Nat AST) + (_lux_: (#FunctionT Nat AST) (_lux_function _ value (_meta (#NatS value)))) #Nil) (_lux_def int$ - (_lux_: (#LambdaT Int AST) + (_lux_: (#FunctionT Int AST) (_lux_function _ value (_meta (#IntS value)))) #Nil) (_lux_def deg$ - (_lux_: (#LambdaT Deg AST) + (_lux_: (#FunctionT Deg AST) (_lux_function _ value (_meta (#DegS value)))) #Nil) (_lux_def real$ - (_lux_: (#LambdaT Real AST) + (_lux_: (#FunctionT Real AST) (_lux_function _ value (_meta (#RealS value)))) #Nil) (_lux_def char$ - (_lux_: (#LambdaT Char AST) + (_lux_: (#FunctionT Char AST) (_lux_function _ value (_meta (#CharS value)))) #Nil) (_lux_def text$ - (_lux_: (#LambdaT Text AST) + (_lux_: (#FunctionT Text AST) (_lux_function _ text (_meta (#TextS text)))) #Nil) (_lux_def symbol$ - (_lux_: (#LambdaT Ident AST) + (_lux_: (#FunctionT Ident AST) (_lux_function _ ident (_meta (#SymbolS ident)))) #Nil) (_lux_def tag$ - (_lux_: (#LambdaT Ident AST) + (_lux_: (#FunctionT Ident AST) (_lux_function _ ident (_meta (#TagS ident)))) #Nil) (_lux_def form$ - (_lux_: (#LambdaT (#AppT List AST) AST) + (_lux_: (#FunctionT (#AppT List AST) AST) (_lux_function _ tokens (_meta (#FormS tokens)))) #Nil) (_lux_def tuple$ - (_lux_: (#LambdaT (#AppT List AST) AST) + (_lux_: (#FunctionT (#AppT List AST) AST) (_lux_function _ tokens (_meta (#TupleS tokens)))) #Nil) (_lux_def record$ - (_lux_: (#LambdaT (#AppT List (#ProdT AST AST)) AST) + (_lux_: (#FunctionT (#AppT List (#ProdT AST AST)) AST) (_lux_function _ tokens (_meta (#RecordS tokens)))) #Nil) @@ -849,7 +849,7 @@ #Nil) (_lux_def with-export-meta - (_lux_: (#LambdaT AST AST) + (_lux_: (#FunctionT AST AST) (function'' [tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons export?-meta @@ -857,7 +857,7 @@ #Nil) (_lux_def with-hidden-meta - (_lux_: (#LambdaT AST AST) + (_lux_: (#FunctionT AST AST) (function'' [tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons hidden?-meta @@ -865,7 +865,7 @@ #Nil) (_lux_def with-macro-meta - (_lux_: (#LambdaT AST AST) + (_lux_: (#FunctionT AST AST) (function'' [tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons macro?-meta @@ -995,9 +995,9 @@ #Nil (#UnivQ #Nil (#UnivQ #Nil - (#LambdaT (#LambdaT (#BoundT +3) (#BoundT +1)) - (#LambdaT ($' List (#BoundT +3)) - ($' List (#BoundT +1)))))) + (#FunctionT (#FunctionT (#BoundT +3) (#BoundT +1)) + (#FunctionT ($' List (#BoundT +3)) + ($' List (#BoundT +1)))))) (_lux_case xs #Nil #Nil @@ -1012,7 +1012,7 @@ (def:'' (make-env xs ys) #Nil - (#LambdaT ($' List Text) (#LambdaT ($' List AST) RepEnv)) + (#FunctionT ($' List Text) (#FunctionT ($' List AST) RepEnv)) (_lux_case [xs ys] [(#Cons x xs') (#Cons y ys')] (#Cons [x y] (make-env xs' ys')) @@ -1022,12 +1022,12 @@ (def:'' (Text/= x y) #Nil - (#LambdaT Text (#LambdaT Text Bool)) + (#FunctionT Text (#FunctionT Text Bool)) (_lux_proc ["text" "="] [x y])) (def:'' (get-rep key env) #Nil - (#LambdaT Text (#LambdaT RepEnv ($' Maybe AST))) + (#FunctionT Text (#FunctionT RepEnv ($' Maybe AST))) (_lux_case env #Nil #None @@ -1042,7 +1042,7 @@ (def:'' (replace-syntax reps syntax) #Nil - (#LambdaT RepEnv (#LambdaT AST AST)) + (#FunctionT RepEnv (#FunctionT AST AST)) (_lux_case syntax [_ (#SymbolS "" name)] (_lux_case (get-rep name reps) @@ -1059,7 +1059,7 @@ [meta (#TupleS (map (replace-syntax reps) members))] [meta (#RecordS slots)] - [meta (#RecordS (map (_lux_: (#LambdaT (#ProdT AST AST) (#ProdT AST AST)) + [meta (#RecordS (map (_lux_: (#FunctionT (#ProdT AST AST) (#ProdT AST AST)) (function'' [slot] (_lux_case slot [k v] @@ -1072,13 +1072,13 @@ (def:'' (update-bounds ast) #Nil - (#LambdaT AST AST) + (#FunctionT AST AST) (_lux_case ast [_ (#TupleS members)] (tuple$ (map update-bounds members)) [_ (#RecordS pairs)] - (record$ (map (_lux_: (#LambdaT (#ProdT AST AST) (#ProdT AST AST)) + (record$ (map (_lux_: (#FunctionT (#ProdT AST AST) (#ProdT AST AST)) (function'' [pair] (let'' [name val] pair [name (update-bounds val)]))) @@ -1096,10 +1096,10 @@ (def:'' (parse-quantified-args args next) #Nil ## (-> (List AST) (-> (List Text) (Lux (List AST))) (Lux (List AST))) - (#LambdaT ($' List AST) - (#LambdaT (#LambdaT ($' List Text) (#AppT Lux ($' List AST))) - (#AppT Lux ($' List AST)) - )) + (#FunctionT ($' List AST) + (#FunctionT (#FunctionT ($' List Text) (#AppT Lux ($' List AST))) + (#AppT Lux ($' List AST)) + )) (_lux_case args #Nil (next #Nil) @@ -1113,18 +1113,18 @@ (def:'' (make-bound idx) #Nil - (#LambdaT Nat AST) + (#FunctionT Nat AST) (form$ (#Cons (tag$ ["lux" "BoundT"]) (#Cons (nat$ idx) #Nil)))) (def:'' (fold f init xs) #Nil ## (All [a b] (-> (-> b a a) a (List b) a)) - (#UnivQ #Nil (#UnivQ #Nil (#LambdaT (#LambdaT (#BoundT +1) - (#LambdaT (#BoundT +3) - (#BoundT +3))) - (#LambdaT (#BoundT +3) - (#LambdaT ($' List (#BoundT +1)) - (#BoundT +3)))))) + (#UnivQ #Nil (#UnivQ #Nil (#FunctionT (#FunctionT (#BoundT +1) + (#FunctionT (#BoundT +3) + (#BoundT +3))) + (#FunctionT (#BoundT +3) + (#FunctionT ($' List (#BoundT +1)) + (#BoundT +3)))))) (_lux_case xs #Nil init @@ -1135,7 +1135,7 @@ (def:'' (length list) #Nil (#UnivQ #Nil - (#LambdaT ($' List (#BoundT +1)) Int)) + (#FunctionT ($' List (#BoundT +1)) Int)) (fold (function'' [_ acc] (_lux_proc ["int" "+"] [1 acc])) 0 list)) (macro:' #export (All tokens) @@ -1158,7 +1158,7 @@ (#Cons [_ (#TupleS args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] - (let'' body' (fold (_lux_: (#LambdaT Text (#LambdaT AST AST)) + (let'' body' (fold (_lux_: (#FunctionT Text (#FunctionT AST AST)) (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "UnivQ"]) (#Cons (tag$ ["lux" "Nil"]) @@ -1209,7 +1209,7 @@ (#Cons [_ (#TupleS args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] - (let'' body' (fold (_lux_: (#LambdaT Text (#LambdaT AST AST)) + (let'' body' (fold (_lux_: (#FunctionT Text (#FunctionT AST AST)) (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "ExQ"]) (#Cons (tag$ ["lux" "Nil"]) @@ -1240,7 +1240,7 @@ (def:'' (reverse list) #Nil - (All [a] (#LambdaT ($' List a) ($' List a))) + (All [a] (#FunctionT ($' List a) ($' List a))) (fold (function'' [head tail] (#Cons head tail)) #Nil list)) @@ -1253,8 +1253,8 @@ #;Nil) (_lux_case (reverse tokens) (#Cons output inputs) - (return (#Cons (fold (_lux_: (#LambdaT AST (#LambdaT AST AST)) - (function'' [i o] (form$ (#Cons (tag$ ["lux" "LambdaT"]) (#Cons i (#Cons o #Nil)))))) + (return (#Cons (fold (_lux_: (#FunctionT AST (#FunctionT AST AST)) + (function'' [i o] (form$ (#Cons (tag$ ["lux" "FunctionT"]) (#Cons i (#Cons o #Nil)))))) output inputs) #Nil)) @@ -3385,8 +3385,8 @@ _ type) - (#LambdaT ?input ?output) - (#LambdaT (beta-reduce env ?input) (beta-reduce env ?output)) + (#FunctionT ?input ?output) + (#FunctionT (beta-reduce env ?input) (beta-reduce env ?output)) (#BoundT idx) (case (nth (_lux_proc ["nat" "to-int"] [idx]) env) @@ -3435,7 +3435,7 @@ [flatten-variant #;SumT] [flatten-tuple #;ProdT] - [flatten-lambda #;LambdaT] + [flatten-lambda #;FunctionT] [flatten-app #;AppT] ) @@ -4228,7 +4228,7 @@ (#ProdT _) ($_ Text/append "[" (|> (flatten-tuple type) (map Type/show) (interpose " ") reverse (fold Text/append "")) "]") - (#LambdaT _) + (#FunctionT _) ($_ Text/append "(-> " (|> (flatten-lambda type) (map Type/show) (interpose " ") reverse (fold Text/append "")) ")") (#BoundT id) @@ -4826,7 +4826,7 @@ (^template [<tag>] (<tag> left right) (<tag> (beta-reduce env left) (beta-reduce env right))) - ([#;LambdaT] + ([#;FunctionT] [#;AppT]) (^template [<tag>] @@ -5098,8 +5098,8 @@ (` (<tag> (~ (type-to-ast left)) (~ (type-to-ast right))))) ([#SumT] [#ProdT]) - (#LambdaT in out) - (` (#LambdaT (~ (type-to-ast in)) (~ (type-to-ast out)))) + (#FunctionT in out) + (` (#FunctionT (~ (type-to-ast in)) (~ (type-to-ast out)))) (#BoundT idx) (` (#BoundT (~ (nat$ idx)))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 4c8f614bc..84edbd1ed 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -2018,7 +2018,7 @@ #;UnitT (:: Monad<Lux> wrap "java.lang.Object") - (^or #;VoidT (#;VarT _) (#;ExT _) (#;BoundT _) (#;SumT _) (#;ProdT _) (#;LambdaT _) (#;UnivQ _) (#;ExQ _)) + (^or #;VoidT (#;VarT _) (#;ExT _) (#;BoundT _) (#;SumT _) (#;ProdT _) (#;FunctionT _) (#;UnivQ _) (#;ExQ _)) (compiler;fail (format "Can't convert to JvmType: " (type;to-text type))) )) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 1dfafe38a..ad966c153 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -110,11 +110,11 @@ (Matcher [Type Type]) (;function [:type:] (case (type;un-name :type:) - (#;LambdaT :left: :right:) + (#;FunctionT :left: :right:) (:: compiler;Monad<Lux> wrap [:left: :right:]) _ - (compiler;fail (format "Not a LambdaT type: " (%type :type:)))))) + (compiler;fail (format "Not a FunctionT type: " (%type :type:)))))) (def: #export func+ (Matcher [(List Type) Type]) @@ -122,7 +122,7 @@ (let [[ins out] (type;flatten-function (type;un-name :type:))] (if (n.> +0 (list;size ins)) (:: compiler;Monad<Lux> wrap [ins out]) - (compiler;fail (format "Not a LambdaT type: " (%type :type:))))))) + (compiler;fail (format "Not a FunctionT type: " (%type :type:))))))) (def: #export tagged (Matcher [(List Ident) Type]) @@ -389,7 +389,7 @@ (<tag> left right) (` (<tag> (~ (to-ast env left)) (~ (to-ast env right))))) - ([#;LambdaT] [#;AppT]) + ([#;FunctionT] [#;AppT]) (^template [<tag> <macro> <flattener>] (<tag> left right) diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 001c95389..be6f282e1 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -21,7 +21,7 @@ (<tag> left right) (<tag> (beta-reduce env left) (beta-reduce env right))) ([#;SumT] [#;ProdT] - [#;LambdaT] [#;AppT]) + [#;FunctionT] [#;AppT]) (^template [<tag>] (<tag> old-env def) @@ -63,7 +63,7 @@ (n.= yid xid)) ([#;VarT] [#;ExT] [#;BoundT]) - (^or [(#;LambdaT xleft xright) (#;LambdaT yleft yright)] + (^or [(#;FunctionT xleft xright) (#;FunctionT yleft yright)] [(#;AppT xleft xright) (#;AppT yleft yright)]) (and (= xleft yleft) (= xright yright)) @@ -109,7 +109,7 @@ (def: #export (flatten-function type) (-> Type [(List Type) Type]) (case type - (#;LambdaT in out') + (#;FunctionT in out') (let [[ins out] (flatten-function out')] [(list& in ins) out]) @@ -180,7 +180,7 @@ (<tag> left right) (` (<tag> (~ (to-ast left)) (~ (to-ast right))))) - ([#;LambdaT] [#;AppT]) + ([#;FunctionT] [#;AppT]) (^template [<tag> <macro> <flattener>] (<tag> left right) @@ -227,7 +227,7 @@ ([#;SumT "(| " ")" flatten-variant] [#;ProdT "[" "]" flatten-tuple]) - (#;LambdaT input output) + (#;FunctionT input output) (let [[ins out] (flatten-function type)] ($_ Text/append "(-> " (|> ins @@ -302,7 +302,7 @@ output (#;Cons input inputs') - (#;LambdaT input (function inputs' output)))) + (#;FunctionT input (function inputs' output)))) (def: #export (application quant params) (-> Type (List Type) Type) diff --git a/stdlib/source/lux/type/auto.lux b/stdlib/source/lux/type/auto.lux index 585617c3a..0ee373f8e 100644 --- a/stdlib/source/lux/type/auto.lux +++ b/stdlib/source/lux/type/auto.lux @@ -159,7 +159,7 @@ (type;apply-type func var)) arg)) - (#;LambdaT input output) + (#;FunctionT input output) (do Monad<Check> [_ (tc;check input arg)] (wrap output)) diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux index a7214a002..6538af56b 100644 --- a/stdlib/source/lux/type/check.lux +++ b/stdlib/source/lux/type/check.lux @@ -218,7 +218,7 @@ [=left (clean t-id left) =right (clean t-id right)] (wrap (<tag> =left =right)))) - ([#;LambdaT] + ([#;FunctionT] [#;AppT] [#;ProdT] [#;SumT]) @@ -488,7 +488,7 @@ ([#;VoidT #;SumT] [#;UnitT #;ProdT]) - [(#;LambdaT eI eO) (#;LambdaT aI aO)] + [(#;FunctionT eI eO) (#;FunctionT aI aO)] (do Monad<Check> [_ (check aI eI)] (check eO aO)) diff --git a/stdlib/test/test/lux/type.lux b/stdlib/test/test/lux/type.lux index 0ebc23489..705306150 100644 --- a/stdlib/test/test/lux/type.lux +++ b/stdlib/test/test/lux/type.lux @@ -112,7 +112,7 @@ extra (|> gen-type (R;filter (function [type] (case type - (^or (#;LambdaT _) (#;AppT _)) + (^or (#;FunctionT _) (#;AppT _)) false _ diff --git a/stdlib/test/test/lux/type/check.lux b/stdlib/test/test/lux/type/check.lux index 8235ff808..b57bec8e8 100644 --- a/stdlib/test/test/lux/type/check.lux +++ b/stdlib/test/test/lux/type/check.lux @@ -55,7 +55,7 @@ (^template [<tag>] (<tag> left right) (and (valid-type? left) (valid-type? right))) - ([#;SumT] [#;ProdT] [#;LambdaT]) + ([#;SumT] [#;ProdT] [#;FunctionT]) (#;NamedT name type') (valid-type? type') @@ -113,10 +113,10 @@ (#;NamedT ["module" "name"] ex)))))) (assert "Can type-check functions." - (and (&;checks? (#;LambdaT Bottom Top) - (#;LambdaT Top Bottom)) - (not (&;checks? (#;LambdaT Top Bottom) - (#;LambdaT Bottom Top))))) + (and (&;checks? (#;FunctionT Bottom Top) + (#;FunctionT Top Bottom)) + (not (&;checks? (#;FunctionT Top Bottom) + (#;FunctionT Bottom Top))))) )) (test: "Type application" |