aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/type.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/type.lux')
-rw-r--r--stdlib/source/library/lux/type.lux84
1 files changed, 42 insertions, 42 deletions
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index fb91a6a2b..ae9314628 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -13,17 +13,17 @@
["<[0]>" code {"+" [Parser]}]]]
[data
["[0]" product]
- ["[0]" text ("[1]\[0]" monoid equivalence)]
- ["[0]" name ("[1]\[0]" equivalence codec)]
+ ["[0]" text ("[1]#[0]" monoid equivalence)]
+ ["[0]" name ("[1]#[0]" equivalence codec)]
[collection
["[0]" array]
- ["[0]" list ("[1]\[0]" functor monoid mix)]]]
+ ["[0]" list ("[1]#[0]" functor monoid mix)]]]
["[0]" macro
[syntax {"+" [syntax:]}]
["[0]" code]]
[math
[number
- ["n" nat ("[1]\[0]" decimal)]]]
+ ["n" nat ("[1]#[0]" decimal)]]]
["[0]" meta
["[0]" location]]]])
@@ -58,7 +58,7 @@
(case type
{.#Apply arg func'}
(let [[func args] (flat_application func')]
- [func (list\composite args (list arg))])
+ [func (list#composite args (list arg))])
_
[type (list)]))
@@ -81,57 +81,57 @@
(-> Type Text)
(case type
{.#Primitive name params}
- ($_ text\composite
+ ($_ text#composite
"(primitive "
(text.enclosed' text.double_quote name)
(|> params
- (list\each (|>> format (text\composite " ")))
- (list\mix (function.flipped text\composite) ""))
+ (list#each (|>> format (text#composite " ")))
+ (list#mix (function.flipped text#composite) ""))
")")
(^template [<tag> <open> <close> <flat>]
[{<tag> _}
- ($_ text\composite <open>
+ ($_ text#composite <open>
(|> (<flat> type)
- (list\each format)
+ (list#each format)
list.reversed
(list.interposed " ")
- (list\mix text\composite ""))
+ (list#mix text#composite ""))
<close>)])
([.#Sum "(Or " ")" flat_variant]
[.#Product "[" "]" flat_tuple])
{.#Function input output}
(let [[ins out] (flat_function type)]
- ($_ text\composite "(-> "
+ ($_ text#composite "(-> "
(|> ins
- (list\each format)
+ (list#each format)
list.reversed
(list.interposed " ")
- (list\mix text\composite ""))
+ (list#mix text#composite ""))
" " (format out) ")"))
{.#Parameter idx}
- (n\encoded idx)
+ (n#encoded idx)
{.#Var id}
- ($_ text\composite "⌈v:" (n\encoded id) "⌋")
+ ($_ text#composite "⌈v:" (n#encoded id) "⌋")
{.#Ex id}
- ($_ text\composite "⟨e:" (n\encoded id) "⟩")
+ ($_ text#composite "⟨e:" (n#encoded id) "⟩")
{.#Apply param fun}
(let [[type_func type_args] (flat_application type)]
- ($_ text\composite "(" (format type_func) " " (|> type_args (list\each format) list.reversed (list.interposed " ") (list\mix text\composite "")) ")"))
+ ($_ text#composite "(" (format type_func) " " (|> type_args (list#each format) list.reversed (list.interposed " ") (list#mix text#composite "")) ")"))
(^template [<tag> <desc>]
[{<tag> env body}
- ($_ text\composite "(" <desc> " {" (|> env (list\each format) (text.interposed " ")) "} " (format body) ")")])
+ ($_ text#composite "(" <desc> " {" (|> env (list#each format) (text.interposed " ")) "} " (format body) ")")])
([.#UnivQ "All"]
[.#ExQ "Ex"])
{.#Named [module name] type}
- ($_ text\composite module "." name)
+ ($_ text#composite module "." name)
))
... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction
@@ -139,7 +139,7 @@
(-> (List Type) Type Type)
(case type
{.#Primitive name params}
- {.#Primitive name (list\each (reduced env) params)}
+ {.#Primitive name (list#each (reduced env) params)}
(^template [<tag>]
[{<tag> left right}
@@ -154,21 +154,21 @@
{<tag> env def}
_
- {<tag> (list\each (reduced env) old_env) def})])
+ {<tag> (list#each (reduced env) old_env) def})])
([.#UnivQ]
[.#ExQ])
{.#Parameter idx}
- (maybe.else (panic! ($_ text\composite
+ (maybe.else (panic! ($_ text#composite
"Unknown type parameter" text.new_line
- " Index: " (n\encoded idx) text.new_line
+ " Index: " (n#encoded idx) text.new_line
"Environment: " (|> env
list.enumeration
- (list\each (.function (_ [index type])
- ($_ text\composite
- (n\encoded index)
+ (list#each (.function (_ [index type])
+ ($_ text#composite
+ (n#encoded index)
" " (..format type))))
- (text.interposed (text\composite text.new_line " ")))))
+ (text.interposed (text#composite text.new_line " ")))))
(list.item idx env))
_
@@ -184,9 +184,9 @@
(same? x y))
(case [x y]
[{.#Primitive xname xparams} {.#Primitive yname yparams}]
- (and (text\= xname yname)
+ (and (text#= xname yname)
(n.= (list.size yparams) (list.size xparams))
- (list\mix (.function (_ [x y] prev) (and prev (= x y)))
+ (list#mix (.function (_ [x y] prev) (and prev (= x y)))
#1
(list.zipped/2 xparams yparams)))
@@ -201,7 +201,7 @@
(= xright yright))
[{.#Named xname xtype} {.#Named yname ytype}]
- (and (name\= xname yname)
+ (and (name#= xname yname)
(= xtype ytype))
(^template [<tag>]
@@ -213,7 +213,7 @@
[{.#ExQ xenv xbody} {.#ExQ yenv ybody}])
(and (n.= (list.size yenv) (list.size xenv))
(= xbody ybody)
- (list\mix (.function (_ [x y] prev) (and prev (= x y)))
+ (list#mix (.function (_ [x y] prev) (and prev (= x y)))
#1
(list.zipped/2 xenv yenv)))
@@ -250,7 +250,7 @@
(case type
{.#Primitive name params}
(` {.#Primitive (~ (code.text name))
- (.list (~+ (list\each code params)))})
+ (.list (~+ (list#each code params)))})
(^template [<tag>]
[{<tag> idx}
@@ -268,7 +268,7 @@
(^template [<tag>]
[{<tag> env body}
- (` {<tag> (.list (~+ (list\each code env)))
+ (` {<tag> (.list (~+ (list#each code env)))
(~ (code body))})])
([.#UnivQ] [.#ExQ])
))
@@ -345,7 +345,7 @@
{.#Apply A F}
(|> (..applied (list A) F)
- (\ maybe.monad each quantified?)
+ (# maybe.monad each quantified?)
(maybe.else #0))
(^or {.#UnivQ _} {.#ExQ _})
@@ -367,7 +367,7 @@
(-> Type [Nat Type])
(case type
(^multi (^ {.#Primitive name (list element_type)})
- (text\= array.type_name name))
+ (text#= array.type_name name))
(let [[depth element_type] (flat_array element_type)]
[(++ depth) element_type])
@@ -396,14 +396,14 @@
[location meta.location
valueT (meta.type valueN)
.let [_ ("lux io log"
- ($_ text\composite
- (name\encoded (name_of ..:log!)) " " (location.format location) text.new_line
+ ($_ text#composite
+ (name#encoded (name_of ..:log!)) " " (location.format location) text.new_line
"Expression: " (case valueC
{.#Some valueC}
(code.format valueC)
{.#None}
- (name\encoded valueN))
+ (name#encoded valueN))
text.new_line
" Type: " (..format valueT)))]]
(in (list (code.identifier valueN))))
@@ -422,7 +422,7 @@
output <code>.any
value (<>.maybe <code>.any)])
(macro.with_identifiers [g!_]
- (let [casterC (` (: (All ((~ g!_) (~+ (list\each code.local_identifier type_vars)))
+ (let [casterC (` (: (All ((~ g!_) (~+ (list#each code.local_identifier type_vars)))
(-> (~ input) (~ output)))
(|>> :expected)))]
(case value
@@ -446,7 +446,7 @@
exemplar ..typed
computation ..typed])
(macro.with_identifiers [g!_]
- (let [typeC (` (All ((~ g!_) (~+ (list\each code.local_identifier type_vars)))
+ (let [typeC (` (All ((~ g!_) (~+ (list#each code.local_identifier type_vars)))
(-> (~ (value@ #type exemplar))
(~ (value@ #type computation)))))
shareC (` (: (~ typeC)
@@ -458,7 +458,7 @@
exemplar ..typed
extraction <code>.any])
(in (list (` (:of ((~! ..:sharing)
- [(~+ (list\each code.local_identifier type_vars))]
+ [(~+ (list#each code.local_identifier type_vars))]
(~ (value@ #type exemplar))
(~ (value@ #expression exemplar))