aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/type.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/type.lux53
1 files changed, 0 insertions, 53 deletions
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index fb2baf861..60aebf7e9 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Basic functionality for working with types."}
[library
[lux (#- function :as)
["@" target]
@@ -30,7 +29,6 @@
(template [<name> <tag>]
[(def: .public (<name> type)
- {#.doc (example "The number of parameters, and the body, of a quantified type.")}
(-> Type [Nat Type])
(loop [num_args 0
type type]
@@ -46,7 +44,6 @@
)
(def: .public (flat_function type)
- {#.doc (example "The input, and the output of a function type.")}
(-> Type [(List Type) Type])
(case type
(#.Function in out')
@@ -57,7 +54,6 @@
[(list) type]))
(def: .public (flat_application type)
- {#.doc (example "The quantified type, and its parameters, for a type-application.")}
(-> Type [Type (List Type)])
(case type
(#.Apply arg func')
@@ -69,7 +65,6 @@
(template [<name> <tag>]
[(def: .public (<name> type)
- {#.doc (example "The members of a composite type.")}
(-> Type (List Type))
(case type
(<tag> left right)
@@ -83,7 +78,6 @@
)
(def: .public (format type)
- {#.doc (example "A (readable) textual representable of a type.")}
(-> Type Text)
(case type
(#.Primitive name params)
@@ -227,7 +221,6 @@
))))
(def: .public (applied params func)
- {#.doc (example "To the extend possible, applies a quantified type to the given parameters.")}
(-> (List Type) Type (Maybe Type))
(case params
#.End
@@ -252,8 +245,6 @@
#.None)))
(def: .public (code type)
- {#.doc (example "A representation of a type as code."
- "The code is such that evaluating it would yield the type value.")}
(-> Type Code)
(case type
(#.Primitive name params)
@@ -282,7 +273,6 @@
))
(def: .public (de_aliased type)
- {#.doc (example "A (potentially named) type that does not have its name shadowed by other names.")}
(-> Type Type)
(case type
(#.Named _ (#.Named name type'))
@@ -292,7 +282,6 @@
type))
(def: .public (anonymous type)
- {#.doc (example "A type without any names covering it.")}
(-> Type Type)
(case type
(#.Named name type')
@@ -303,7 +292,6 @@
(template [<name> <base> <ctor>]
[(def: .public (<name> types)
- {#.doc (example "A composite type, constituted by the given member types.")}
(-> (List Type) Type)
(case types
#.End
@@ -320,7 +308,6 @@
)
(def: .public (function inputs output)
- {#.doc (example "A function type, with the given inputs and output.")}
(-> (List Type) Type Type)
(case inputs
#.End
@@ -330,7 +317,6 @@
(#.Function input (function inputs' output))))
(def: .public (application params quant)
- {#.doc (example "An un-evaluated type application, with the given quantified type, and parameters.")}
(-> (List Type) Type Type)
(case params
#.End
@@ -341,7 +327,6 @@
(template [<name> <tag>]
[(def: .public (<name> size body)
- {#.doc (example "A quantified type, with the given number of parameters, and body.")}
(-> Nat Type Type)
(case size
0 body
@@ -352,7 +337,6 @@
)
(def: .public (quantified? type)
- {#.doc (example "Only yields #1 for universally or existentially quantified types.")}
(-> Type Bit)
(case type
(#.Named [module name] _type)
@@ -370,7 +354,6 @@
#0))
(def: .public (array depth element_type)
- {#.doc (example "An array type, with the given level of nesting/depth, and the given element type.")}
(-> Nat Type Type)
(case depth
0 element_type
@@ -380,7 +363,6 @@
(#.Primitive array.type_name))))
(def: .public (flat_array type)
- {#.doc (example "The level of nesting/depth and element type for an array type.")}
(-> Type [Nat Type])
(case type
(^multi (^ (#.Primitive name (list element_type)))
@@ -392,7 +374,6 @@
[0 type]))
(def: .public array?
- {#.doc (example "Is a type an array type?")}
(-> Type Bit)
(|>> ..flat_array
product.left
@@ -408,12 +389,6 @@
(syntax: .public (:log! [input (<>.or (<>.and <code>.identifier
(<>.maybe (<>.after (<code>.identifier! ..secret_marker) <code>.any)))
<code>.any)])
- {#.doc (example "Logs to the console/terminal the type of an expression."
- (:log! (: Foo (foo expression)))
- "=>"
- "Expression: (foo expression)"
- " Type: Foo"
- (foo expression))}
(case input
(#.Left [valueN valueC])
(do meta.monad
@@ -445,15 +420,6 @@
input <code>.any
output <code>.any
value (<>.maybe <code>.any)])
- {#.doc (example "Casts a value to a specific type."
- "The specified type can depend on type variables of the original type of the value."
- (: (Bar Bit Nat Text)
- (:as [a b c]
- (Foo a [b c])
- (Bar a b c)
- (: (Foo Bit [Nat Text])
- (foo expression))))
- "NOTE: Careless use of type-casts is an easy way to introduce bugs. USE WITH CAUTION.")}
(let [casterC (` (: (All [(~+ (list\each code.local_identifier type_vars))]
(-> (~ input) (~ output)))
(|>> :expected)))]
@@ -477,15 +443,6 @@
(syntax: .public (:sharing [type_vars ..type_parameters
exemplar ..typed
computation ..typed])
- {#.doc (example "Allows specifing the type of an expression as sharing type-variables with the type of another expression."
- (: (Bar Bit Nat Text)
- (:sharing [a b c]
- (Foo a [b c])
- (: (Foo Bit [Nat Text])
- (foo expression))
-
- (Bar a b c)
- (bar expression))))}
(macro.with_identifiers [g!_]
(let [shareC (` (: (All [(~+ (list\each code.local_identifier type_vars))]
(-> (~ (value@ #type exemplar))
@@ -497,16 +454,6 @@
(syntax: .public (:by_example [type_vars ..type_parameters
exemplar ..typed
extraction <code>.any])
- {#.doc (example "Constructs a type that shares type-variables with an expression of some other type."
- (: Type
- (:by_example [a b c]
- (Foo a [b c])
- (: (Foo Bit [Nat Text])
- (foo expression))
-
- (Bar a b c)))
- "=>"
- (.type (Bar Bit Nat Text)))}
(in (list (` (:of ((~! :sharing)
[(~+ (list\each code.local_identifier type_vars))]