aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/type/check.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/type/check.lux')
-rw-r--r--stdlib/source/library/lux/type/check.lux24
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 1c04d9482..10fe700e8 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -8,10 +8,10 @@
[apply (#+ Apply)]
["." monad (#+ Monad do)]]
[control
+ ["." maybe]
["." try (#+ Try)]
["." exception (#+ Exception exception:)]]
[data
- ["." maybe]
["." product]
["." text ("#\." monoid equivalence)]
[collection
@@ -53,14 +53,14 @@
["Actual" (//.format actual)]))
(type: .public Var
- {#.doc (doc "The ID for a type-variable in a type-checking context.")}
+ {#.doc (example "The ID for a type-variable in a type-checking context.")}
Nat)
(type: Assumption
[Type Type])
(type: .public (Check a)
- {#.doc (doc "A type-checking computation which may fail or yield a value.")}
+ {#.doc (example "A type-checking computation which may fail or yield a value.")}
(-> Type_Context (Try [Type_Context a])))
(type: (Checker a)
@@ -159,7 +159,7 @@
(#.Item [var_id var_type]
(var::put id value plist')))))
-(def: .public (run context proc)
+(def: .public (result context proc)
(All [a] (-> Type_Context (Check a) (Try a)))
(case (proc context)
(#try.Success [context' output])
@@ -236,8 +236,8 @@
(exception.except ..unknown_type_var id))))
(def: .public (bind type id)
- {#.doc (doc "Attemmpts to buy a type-variable."
- "Fails if the variable has been bound already.")}
+ {#.doc (example "Attemmpts to buy a type-variable."
+ "Fails if the variable has been bound already.")}
(-> Type Var (Check Any))
(function (_ context)
(case (|> context (get@ #.var_bindings) (var::get id))
@@ -263,7 +263,7 @@
(exception.except ..unknown_type_var id))))
(def: .public var
- {#.doc (doc "A brand-new (unbound) type-variable.")}
+ {#.doc (example "A brand-new (unbound) type-variable.")}
(Check [Var Type])
(function (_ context)
(let [id (get@ #.var_counter context)]
@@ -329,7 +329,7 @@
(exception.except ..unknown_type_var current)))))
(def: .public fresh_context
- {#.doc (doc "An empty/un-used type-checking context.")}
+ {#.doc (example "An empty/un-used type-checking context.")}
Type_Context
{#.var_counter 0
#.ex_counter 0
@@ -675,10 +675,10 @@
(-> Type Type (Check Any))
(check' (list) expected actual))
-(def: .public (checks? expected actual)
+(def: .public (subsumes? expected actual)
{#.doc "A simple type-checking function that just returns a yes/no answer."}
(-> Type Type Bit)
- (case (..run ..fresh_context (..check' (list) expected actual))
+ (case (..result ..fresh_context (..check' (list) expected actual))
(#try.Failure _)
false
@@ -686,13 +686,13 @@
true))
(def: .public context
- {#.doc (doc "The current state of the type-checking context.")}
+ {#.doc (example "The current state of the type-checking context.")}
(Check Type_Context)
(function (_ context)
(#try.Success [context context])))
(def: .public (clean inputT)
- {#.doc (doc "Resolves every bound type-variable to yield a new type that is as resolved as possible.")}
+ {#.doc (example "Resolves every bound type-variable to yield a new type that is as resolved as possible.")}
(-> Type (Check Type))
(case inputT
(#.Primitive name paramsT+)