aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2017-04-10 23:21:35 -0400
committerEduardo Julian2017-04-10 23:21:35 -0400
commita1b2a8120921ccca79e95b8bd35b475b34dd9780 (patch)
tree721634e556f66d3d8afcae181320c503c3b708df /stdlib
parent6066515f7a9736210a04652636a634179939d185 (diff)
- Renamed "LambdaT" to "FunctionT".
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/lux.lux138
-rw-r--r--stdlib/source/lux/host.jvm.lux2
-rw-r--r--stdlib/source/lux/macro/poly.lux8
-rw-r--r--stdlib/source/lux/type.lux12
-rw-r--r--stdlib/source/lux/type/auto.lux2
-rw-r--r--stdlib/source/lux/type/check.lux4
-rw-r--r--stdlib/test/test/lux/type.lux2
-rw-r--r--stdlib/test/test/lux/type/check.lux10
8 files changed, 89 insertions, 89 deletions
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"