aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2018-07-21 00:49:34 -0400
committerEduardo Julian2018-07-21 00:49:34 -0400
commite550029ac3ca8eecade4705020b9cf24312227f5 (patch)
tree1762f0a77dfb73989f5ddb92f470e4dd58385b32 /stdlib
parent47890ee876d2a33d9d7d1c559912123359ab9f87 (diff)
Moved "lux/language/type/*" to "lux/type/*".
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/collection/set/multi.lux4
-rw-r--r--stdlib/source/lux/data/text/format.lux3
-rw-r--r--stdlib/source/lux/host.jvm.lux8
-rw-r--r--stdlib/source/lux/language/compiler/analysis/case.lux69
-rw-r--r--stdlib/source/lux/language/compiler/analysis/function.lux19
-rw-r--r--stdlib/source/lux/language/compiler/analysis/inference.lux17
-rw-r--r--stdlib/source/lux/language/compiler/analysis/reference.lux3
-rw-r--r--stdlib/source/lux/language/compiler/analysis/structure.lux26
-rw-r--r--stdlib/source/lux/language/compiler/analysis/type.lux7
-rw-r--r--stdlib/source/lux/language/compiler/default/repl/type.lux5
-rw-r--r--stdlib/source/lux/language/compiler/extension/analysis/common.lux32
-rw-r--r--stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux5
-rw-r--r--stdlib/source/lux/language/compiler/meta/archive.lux4
-rw-r--r--stdlib/source/lux/macro/poly.lux6
-rw-r--r--stdlib/source/lux/macro/poly/equivalence.lux6
-rw-r--r--stdlib/source/lux/macro/poly/functor.lux3
-rw-r--r--stdlib/source/lux/macro/poly/json.lux6
-rw-r--r--stdlib/source/lux/type.lux (renamed from stdlib/source/lux/language/type.lux)0
-rw-r--r--stdlib/source/lux/type/abstract.lux3
-rw-r--r--stdlib/source/lux/type/check.lux (renamed from stdlib/source/lux/language/type/check.lux)156
-rw-r--r--stdlib/source/lux/type/implicit.lux5
-rw-r--r--stdlib/source/lux/type/object/interface.lux5
-rw-r--r--stdlib/source/lux/type/quotient.lux4
-rw-r--r--stdlib/source/lux/type/refinement.lux4
-rw-r--r--stdlib/test/test/lux/language/compiler/analysis/case.lux4
-rw-r--r--stdlib/test/test/lux/language/compiler/analysis/function.lux2
-rw-r--r--stdlib/test/test/lux/language/compiler/analysis/primitive.lux2
-rw-r--r--stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux2
-rw-r--r--stdlib/test/test/lux/language/compiler/analysis/reference.lux5
-rw-r--r--stdlib/test/test/lux/language/compiler/analysis/structure.lux4
-rw-r--r--stdlib/test/test/lux/math/modular.lux3
-rw-r--r--stdlib/test/test/lux/type.lux (renamed from stdlib/test/test/lux/language/type.lux)3
-rw-r--r--stdlib/test/test/lux/type/check.lux (renamed from stdlib/test/test/lux/language/type/check.lux)5
-rw-r--r--stdlib/test/tests.lux5
34 files changed, 199 insertions, 236 deletions
diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux
index c4d67b8fe..eb8e914e3 100644
--- a/stdlib/source/lux/data/collection/set/multi.lux
+++ b/stdlib/source/lux/data/collection/set/multi.lux
@@ -5,9 +5,7 @@
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]]
["." function]
- [language
- [type (#+ :share)]]
- [type
+ [type (#+ :share)
abstract]]
[////
["." maybe]]
diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux
index acab4c72b..7592b7b28 100644
--- a/stdlib/source/lux/data/text/format.lux
+++ b/stdlib/source/lux/data/text/format.lux
@@ -22,8 +22,7 @@
["." macro
["." code]
["s" syntax (#+ syntax: Syntax)]]
- [language
- ["." type]]])
+ ["." type]])
## [Syntax]
(syntax: #export (format {fragments (p.many s.any)})
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index fe72467bf..a3f8a82c4 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -4,8 +4,6 @@
["." monad (#+ do Monad)]
["." enum]
["p" parser]]
- ["." io]
- function
[data
["." maybe]
["." product]
@@ -16,12 +14,12 @@
format]
[collection
["." list ("list/." Monad<List> Fold<List> Monoid<List>)]]]
+ function
+ ["." type ("type/." Equivalence<Type>)]
["." macro (#+ with-gensyms Functor<Meta> Monad<Meta>)
["." code]
["s" syntax (#+ syntax: Syntax)]]
- [language
- ["." type ("type/." Equivalence<Type>)]]
- ])
+ ["." io]])
(do-template [<name> <op> <from> <to>]
[(def: #export (<name> value)
diff --git a/stdlib/source/lux/language/compiler/analysis/case.lux b/stdlib/source/lux/language/compiler/analysis/case.lux
index 09a045e8c..841173629 100644
--- a/stdlib/source/lux/language/compiler/analysis/case.lux
+++ b/stdlib/source/lux/language/compiler/analysis/case.lux
@@ -11,6 +11,8 @@
format]
[collection
["." list ("list/." Fold<List> Monoid<List> Functor<List>)]]]
+ ["." type
+ ["." check]]
["." macro
["." code]]]
["." // (#+ Pattern Analysis Operation Compiler)
@@ -18,25 +20,22 @@
["//." type]
["." structure]
["/." //
- ["." extension]
- [//
- ["." type
- ["tc" check]]]]]
+ ["." extension]]]
[/
["." coverage]])
-(exception: #export (cannot-match-type-with-pattern {type Type} {pattern Code})
+(exception: #export (cannot-match-with-pattern {type Type} {pattern Code})
(ex.report ["Type" (%type type)]
["Pattern" (%code pattern)]))
-(exception: #export (sum-type-has-no-case {case Nat} {type Type})
+(exception: #export (sum-has-no-case {case Nat} {type Type})
(ex.report ["Case" (%n case)]
["Type" (%type type)]))
(exception: #export (unrecognized-pattern-syntax {pattern Code})
(%code pattern))
-(exception: #export (cannot-simplify-type-for-pattern-matching {type Type})
+(exception: #export (cannot-simplify-for-pattern-matching {type Type})
(%type type))
(do-template [<name>]
@@ -63,7 +62,7 @@
## type-variables or quantifications.
## This function makes it easier for "case" analysis to properly
## type-check the input with respect to the patterns.
-(def: (simplify-case-type caseT)
+(def: (simplify-case caseT)
(-> Type (Operation Type))
(loop [envs (: (List (List Type))
(list))
@@ -72,13 +71,13 @@
(#.Var id)
(do ///.Monad<Operation>
[?caseT' (//type.with-env
- (tc.read id))]
+ (check.read id))]
(.case ?caseT'
(#.Some caseT')
(recur envs caseT')
_
- (///.throw cannot-simplify-type-for-pattern-matching caseT)))
+ (///.throw cannot-simplify-for-pattern-matching caseT)))
(#.Named name unnamedT)
(recur envs unnamedT)
@@ -89,7 +88,7 @@
(#.ExQ _)
(do ///.Monad<Operation>
[[ex-id exT] (//type.with-env
- tc.existential)]
+ check.existential)]
(recur envs (maybe.assume (type.apply (list exT) caseT))))
(#.Apply inputT funcT)
@@ -97,14 +96,14 @@
(#.Var funcT-id)
(do ///.Monad<Operation>
[funcT' (//type.with-env
- (do tc.Monad<Check>
- [?funct' (tc.read funcT-id)]
+ (do check.Monad<Check>
+ [?funct' (check.read funcT-id)]
(.case ?funct'
(#.Some funct')
(wrap funct')
_
- (tc.throw cannot-simplify-type-for-pattern-matching caseT))))]
+ (check.throw cannot-simplify-for-pattern-matching caseT))))]
(recur envs (#.Apply inputT funcT')))
_
@@ -113,7 +112,7 @@
(recur envs outputT)
#.None
- (///.throw cannot-simplify-type-for-pattern-matching caseT)))
+ (///.throw cannot-simplify-for-pattern-matching caseT)))
(#.Product _)
(|> caseT
@@ -130,7 +129,7 @@
(//.with-cursor cursor
(do ///.Monad<Operation>
[_ (//type.with-env
- (tc.check inputT type))
+ (check.check inputT type))
outputA next]
(wrap [output outputA]))))
@@ -178,23 +177,23 @@
[cursor (#.Tuple sub-patterns)]
(//.with-cursor cursor
(do ///.Monad<Operation>
- [inputT' (simplify-case-type inputT)]
+ [inputT' (simplify-case inputT)]
(.case inputT'
(#.Product _)
- (let [sub-types (type.flatten-tuple inputT')
- num-sub-types (maybe.default (list.size sub-types)
- num-tags)
+ (let [subs (type.flatten-tuple inputT')
+ num-subs (maybe.default (list.size subs)
+ num-tags)
num-sub-patterns (list.size sub-patterns)
- matches (cond (n/< num-sub-types num-sub-patterns)
- (let [[prefix suffix] (list.split (dec num-sub-patterns) sub-types)]
+ matches (cond (n/< num-subs num-sub-patterns)
+ (let [[prefix suffix] (list.split (dec num-sub-patterns) subs)]
(list.zip2 (list/compose prefix (list (type.tuple suffix))) sub-patterns))
- (n/> num-sub-types num-sub-patterns)
- (let [[prefix suffix] (list.split (dec num-sub-types) sub-patterns)]
- (list.zip2 sub-types (list/compose prefix (list (code.tuple suffix)))))
+ (n/> num-subs num-sub-patterns)
+ (let [[prefix suffix] (list.split (dec num-subs) sub-patterns)]
+ (list.zip2 subs (list/compose prefix (list (code.tuple suffix)))))
- ## (n/= num-sub-types num-sub-patterns)
- (list.zip2 sub-types sub-patterns))]
+ ## (n/= num-subs num-sub-patterns)
+ (list.zip2 subs sub-patterns))]
(do @
[[memberP+ thenA] (list/fold (: (All [a]
(-> [Type Code] (Operation [(List Pattern) a])
@@ -213,7 +212,7 @@
thenA])))
_
- (///.throw cannot-match-type-with-pattern [inputT pattern])
+ (///.throw cannot-match-with-pattern [inputT pattern])
)))
[cursor (#.Record record)]
@@ -221,7 +220,7 @@
[record (structure.normalize record)
[members recordT] (structure.order record)
_ (//type.with-env
- (tc.check inputT recordT))]
+ (check.check inputT recordT))]
(analyse-pattern (#.Some (list.size members)) inputT [cursor (#.Tuple members)] next))
[cursor (#.Tag tag)]
@@ -231,14 +230,14 @@
(^ [cursor (#.Form (list& [_ (#.Nat idx)] values))])
(//.with-cursor cursor
(do ///.Monad<Operation>
- [inputT' (simplify-case-type inputT)]
+ [inputT' (simplify-case inputT)]
(.case inputT'
(#.Sum _)
(let [flat-sum (type.flatten-variant inputT')
size-sum (list.size flat-sum)
num-cases (maybe.default size-sum num-tags)]
(.case (list.nth idx flat-sum)
- (^multi (#.Some case-type)
+ (^multi (#.Some caseT)
(n/< num-cases idx))
(do ///.Monad<Operation>
[[testP nextA] (if (and (n/> num-cases size-sum)
@@ -247,15 +246,15 @@
(type.variant (list.drop (dec num-cases) flat-sum))
(` [(~+ values)])
next)
- (analyse-pattern #.None case-type (` [(~+ values)]) next))]
+ (analyse-pattern #.None caseT (` [(~+ values)]) next))]
(wrap [(//.sum-pattern num-cases idx testP)
nextA]))
_
- (///.throw sum-type-has-no-case [idx inputT])))
+ (///.throw sum-has-no-case [idx inputT])))
_
- (///.throw cannot-match-type-with-pattern [inputT pattern]))))
+ (///.throw cannot-match-with-pattern [inputT pattern]))))
(^ [cursor (#.Form (list& [_ (#.Tag tag)] values))])
(//.with-cursor cursor
@@ -263,7 +262,7 @@
[tag (extension.lift (macro.normalize tag))
[idx group variantT] (extension.lift (macro.resolve-tag tag))
_ (//type.with-env
- (tc.check inputT variantT))]
+ (check.check inputT variantT))]
(analyse-pattern (#.Some (list.size group)) inputT (` ((~ (code.nat idx)) (~+ values))) next)))
_
diff --git a/stdlib/source/lux/language/compiler/analysis/function.lux b/stdlib/source/lux/language/compiler/analysis/function.lux
index cc431f9b6..d12880afa 100644
--- a/stdlib/source/lux/language/compiler/analysis/function.lux
+++ b/stdlib/source/lux/language/compiler/analysis/function.lux
@@ -9,10 +9,9 @@
format]
[collection
["." list ("list/." Fold<List> Monoid<List> Monad<List>)]]]
- ["." macro]
- [language
- ["." type
- ["tc" check]]]]
+ ["." type
+ ["." check]]
+ ["." macro]]
["." // (#+ Analysis Operation Compiler)
["." scope]
["//." type]
@@ -57,13 +56,13 @@
(do @
[[_ instanceT] (//type.with-env <instancer>)]
(recur (maybe.assume (type.apply (list instanceT) expectedT)))))
- ([#.UnivQ tc.existential]
- [#.ExQ tc.var])
+ ([#.UnivQ check.existential]
+ [#.ExQ check.var])
(#.Var id)
(do @
[?expectedT' (//type.with-env
- (tc.read id))]
+ (check.read id))]
(case ?expectedT'
(#.Some expectedT')
(recur expectedT')
@@ -71,12 +70,12 @@
## Inference
_
(do @
- [[input-id inputT] (//type.with-env tc.var)
- [output-id outputT] (//type.with-env tc.var)
+ [[input-id inputT] (//type.with-env check.var)
+ [output-id outputT] (//type.with-env check.var)
#let [functionT (#.Function inputT outputT)]
functionA (recur functionT)
_ (//type.with-env
- (tc.check expectedT functionT))]
+ (check.check expectedT functionT))]
(wrap functionA))
))
diff --git a/stdlib/source/lux/language/compiler/analysis/inference.lux b/stdlib/source/lux/language/compiler/analysis/inference.lux
index e068f073a..160978d39 100644
--- a/stdlib/source/lux/language/compiler/analysis/inference.lux
+++ b/stdlib/source/lux/language/compiler/analysis/inference.lux
@@ -9,10 +9,9 @@
format]
[collection
["." list ("list/." Functor<List>)]]]
- ["." macro]]
- [////
["." type
- ["tc" check]]]
+ ["." check]]
+ ["." macro]]
["." /// ("operation/." Monad<Operation>)
["." extension]]
[// (#+ Tag Analysis Operation Compiler)]
@@ -87,7 +86,7 @@
(Operation Type)
(do ///.Monad<Operation>
[cursor (extension.lift macro.cursor)
- [ex-id _] (//type.with-env tc.existential)]
+ [ex-id _] (//type.with-env check.existential)]
(wrap (named-type cursor ex-id))))
## Type-inference works by applying some (potentially quantified) type
@@ -112,23 +111,23 @@
(#.UnivQ _)
(do ///.Monad<Operation>
- [[var-id varT] (//type.with-env tc.var)]
+ [[var-id varT] (//type.with-env check.var)]
(general analyse (maybe.assume (type.apply (list varT) inferT)) args))
(#.ExQ _)
(do ///.Monad<Operation>
- [[var-id varT] (//type.with-env tc.var)
+ [[var-id varT] (//type.with-env check.var)
output (general analyse
(maybe.assume (type.apply (list varT) inferT))
args)
bound? (//type.with-env
- (tc.bound? var-id))
+ (check.bound? var-id))
_ (if bound?
(wrap [])
(do @
[newT new-named-type]
(//type.with-env
- (tc.check varT newT))))]
+ (check.check varT newT))))]
(wrap output))
(#.Apply inputT transT)
@@ -156,7 +155,7 @@
(#.Var infer-id)
(do ///.Monad<Operation>
- [?inferT' (//type.with-env (tc.read infer-id))]
+ [?inferT' (//type.with-env (check.read infer-id))]
(case ?inferT'
(#.Some inferT')
(general analyse inferT' args)
diff --git a/stdlib/source/lux/language/compiler/analysis/reference.lux b/stdlib/source/lux/language/compiler/analysis/reference.lux
index 4fdbde5c2..bb78a32fb 100644
--- a/stdlib/source/lux/language/compiler/analysis/reference.lux
+++ b/stdlib/source/lux/language/compiler/analysis/reference.lux
@@ -4,9 +4,6 @@
monad
["ex" exception (#+ exception:)]]
["." macro]
- [language
- [type
- ["tc" check]]]
[data
[text ("text/." Equivalence<Text>)
format]]]
diff --git a/stdlib/source/lux/language/compiler/analysis/structure.lux b/stdlib/source/lux/language/compiler/analysis/structure.lux
index 77a0487c5..b2eb5dc17 100644
--- a/stdlib/source/lux/language/compiler/analysis/structure.lux
+++ b/stdlib/source/lux/language/compiler/analysis/structure.lux
@@ -13,6 +13,8 @@
[collection
["." list ("list/." Functor<List>)]
["dict" dictionary (#+ Dictionary)]]]
+ ["." type
+ ["." check]]
["." macro
["." code]]]
["." // (#+ Tag Analysis Operation Compiler)
@@ -21,9 +23,7 @@
["." inference]
["/." //
["." extension]
- ["//." //
- ["." type
- ["tc" check]]]]])
+ ["//." //]]])
(exception: #export (invalid-variant-type {type Type} {tag Tag} {code Code})
(ex.report ["Type" (%type type)]
@@ -105,7 +105,7 @@
(#.Var id)
(do @
[?expectedT' (//type.with-env
- (tc.read id))]
+ (check.read id))]
(case ?expectedT'
(#.Some expectedT')
(//type.with-type expectedT'
@@ -124,14 +124,14 @@
[[instance-id instanceT] (//type.with-env <instancer>)]
(//type.with-type (maybe.assume (type.apply (list instanceT) expectedT))
(sum analyse tag valueC))))
- ([#.UnivQ tc.existential]
- [#.ExQ tc.var])
+ ([#.UnivQ check.existential]
+ [#.ExQ check.var])
(#.Apply inputT funT)
(case funT
(#.Var funT-id)
(do @
- [?funT' (//type.with-env (tc.read funT-id))]
+ [?funT' (//type.with-env (check.read funT-id))]
(case ?funT'
(#.Some funT')
(//type.with-type (#.Apply inputT funT')
@@ -207,7 +207,7 @@
(#.Var id)
(do @
[?expectedT' (//type.with-env
- (tc.read id))]
+ (check.read id))]
(case ?expectedT'
(#.Some expectedT')
(//type.with-type expectedT'
@@ -219,8 +219,8 @@
[membersTA (monad.map @ (|>> analyse //type.with-inference)
membersC)
_ (//type.with-env
- (tc.check expectedT
- (type.tuple (list/map product.left membersTA))))]
+ (check.check expectedT
+ (type.tuple (list/map product.left membersTA))))]
(wrap (//.product-analysis (list/map product.right membersTA))))))
(^template [<tag> <instancer>]
@@ -229,14 +229,14 @@
[[instance-id instanceT] (//type.with-env <instancer>)]
(//type.with-type (maybe.assume (type.apply (list instanceT) expectedT))
(product analyse membersC))))
- ([#.UnivQ tc.existential]
- [#.ExQ tc.var])
+ ([#.UnivQ check.existential]
+ [#.ExQ check.var])
(#.Apply inputT funT)
(case funT
(#.Var funT-id)
(do @
- [?funT' (//type.with-env (tc.read funT-id))]
+ [?funT' (//type.with-env (check.read funT-id))]
(case ?funT'
(#.Some funT')
(//type.with-type (#.Apply inputT funT')
diff --git a/stdlib/source/lux/language/compiler/analysis/type.lux b/stdlib/source/lux/language/compiler/analysis/type.lux
index 8bc0bd53b..3eb574986 100644
--- a/stdlib/source/lux/language/compiler/analysis/type.lux
+++ b/stdlib/source/lux/language/compiler/analysis/type.lux
@@ -5,10 +5,9 @@
[data
["." error]]
["." function]
- ["." macro]
- [language
- [type
- ["tc" check]]]]
+ [type
+ ["tc" check]]
+ ["." macro]]
[// (#+ Operation)
["/." //
["." extension]]])
diff --git a/stdlib/source/lux/language/compiler/default/repl/type.lux b/stdlib/source/lux/language/compiler/default/repl/type.lux
index 4b2b8dc02..635624e67 100644
--- a/stdlib/source/lux/language/compiler/default/repl/type.lux
+++ b/stdlib/source/lux/language/compiler/default/repl/type.lux
@@ -19,11 +19,10 @@
[duration (#+ Duration)]
[date (#+ Date)]]
["." function]
+ ["." type]
["." macro
["." code]
- ["." poly (#+ Poly)]]
- [language
- ["." type]]])
+ ["." poly (#+ Poly)]]])
(exception: #export (cannot-represent-value {type Type})
(ex.report ["Type" (%type type)]))
diff --git a/stdlib/source/lux/language/compiler/extension/analysis/common.lux b/stdlib/source/lux/language/compiler/extension/analysis/common.lux
index 7f3c4d947..201616ac9 100644
--- a/stdlib/source/lux/language/compiler/extension/analysis/common.lux
+++ b/stdlib/source/lux/language/compiler/extension/analysis/common.lux
@@ -13,9 +13,9 @@
["." list ("list/." Functor<List>)]
["." array]
["dict" dictionary (#+ Dictionary)]]]
- ["." language
- [type
- ["tc" check]]]
+ [type
+ ["." check]]
+ ["." language]
[io (#+ IO)]]
["." ////
["." analysis (#+ Analysis Handler Bundle)
@@ -64,7 +64,7 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)]
+ [[var-id varT] (typeA.with-env check.var)]
((binary varT varT Bit extension-name)
analyse args))))
@@ -76,7 +76,7 @@
(case args
(^ (list opC))
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)
+ [[var-id varT] (typeA.with-env check.var)
_ (typeA.infer (type (Either Text varT)))
opA (typeA.with-type (type (IO varT))
(analyse opC))]
@@ -210,7 +210,7 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)]
+ [[var-id varT] (typeA.with-env check.var)]
((binary (type (Array varT)) Nat (type (Maybe varT)) extension-name)
analyse args))))
@@ -218,7 +218,7 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)]
+ [[var-id varT] (typeA.with-env check.var)]
((trinary (type (Array varT)) Nat varT (type (Array varT)) extension-name)
analyse args))))
@@ -226,7 +226,7 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)]
+ [[var-id varT] (typeA.with-env check.var)]
((binary (type (Array varT)) Nat (type (Array varT)) extension-name)
analyse args))))
@@ -269,7 +269,7 @@
(case args
(^ (list initC))
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)
+ [[var-id varT] (typeA.with-env check.var)
_ (typeA.infer (type (Atom varT)))
initA (typeA.with-type varT
(analyse initC))]
@@ -282,7 +282,7 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)]
+ [[var-id varT] (typeA.with-env check.var)]
((unary (type (Atom varT)) varT extension-name)
analyse args))))
@@ -290,7 +290,7 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)]
+ [[var-id varT] (typeA.with-env check.var)]
((trinary (type (Atom varT)) varT varT Bit extension-name)
analyse args))))
@@ -309,7 +309,7 @@
(case args
(^ (list initC))
(do ////.Monad<Operation>
- [[var-id varT] (typeA.with-env tc.var)
+ [[var-id varT] (typeA.with-env check.var)
_ (typeA.infer (type (All [!] (Box ! varT))))
initA (typeA.with-type varT
(analyse initC))]
@@ -322,8 +322,8 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[thread-id threadT] (typeA.with-env tc.var)
- [var-id varT] (typeA.with-env tc.var)]
+ [[thread-id threadT] (typeA.with-env check.var)
+ [var-id varT] (typeA.with-env check.var)]
((unary (type (Box threadT varT)) varT extension-name)
analyse args))))
@@ -331,8 +331,8 @@
Handler
(function (_ extension-name analyse args)
(do ////.Monad<Operation>
- [[thread-id threadT] (typeA.with-env tc.var)
- [var-id varT] (typeA.with-env tc.var)]
+ [[thread-id threadT] (typeA.with-env check.var)
+ [var-id varT] (typeA.with-env check.var)]
((binary varT (type (Box threadT varT)) Any extension-name)
analyse args))))
diff --git a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux
index 24d3948b0..0edd20d2b 100644
--- a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux
+++ b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux
@@ -15,11 +15,10 @@
["." list ("list/." Fold<List> Functor<List> Monoid<List>)]
["." array]
["." dictionary (#+ Dictionary)]]]
+ ["." type
+ ["." check]]
["." macro
["s" syntax]]
- [language
- ["." type
- ["." check]]]
["." host]]
[//
["." common]
diff --git a/stdlib/source/lux/language/compiler/meta/archive.lux b/stdlib/source/lux/language/compiler/meta/archive.lux
index 570221385..9feaf523f 100644
--- a/stdlib/source/lux/language/compiler/meta/archive.lux
+++ b/stdlib/source/lux/language/compiler/meta/archive.lux
@@ -11,9 +11,7 @@
format]
[collection
["dict" dictionary (#+ Dictionary)]]]
- [language
- [type (#+ :share)]]
- [type
+ [type (#+ :share)
abstract]
[world
[file (#+ File)]]]
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index 96d806c81..964f857a1 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -25,10 +25,8 @@
[common
["csr" reader]
["csw" writer]]]]
- [language
- ["." type ("type/." Equivalence<Type>)
- ["." check]]]
- ])
+ ["." type ("type/." Equivalence<Type>)
+ ["." check]]])
(type: #export Env (Dictionary Nat [Type Code]))
diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux
index 1dd8757e4..ae910874c 100644
--- a/stdlib/source/lux/macro/poly/equivalence.lux
+++ b/stdlib/source/lux/macro/poly/equivalence.lux
@@ -29,10 +29,8 @@
[syntax (#+ syntax: Syntax)
["." common]]
["." poly (#+ poly:)]]
- [type
- ["." unit]]
- [language
- ["." type]]])
+ ["." type
+ ["." unit]]])
## [Derivers]
(poly: #export Equivalence<?>
diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux
index 45cf169f7..90a2ecde0 100644
--- a/stdlib/source/lux/macro/poly/functor.lux
+++ b/stdlib/source/lux/macro/poly/functor.lux
@@ -15,8 +15,7 @@
[syntax (#+ syntax: Syntax)
["." common]]
["." poly (#+ poly:)]]
- [language
- ["." type]]])
+ ["." type]])
(poly: #export Functor<?>
(do @
diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux
index 66014ae56..596d24b18 100644
--- a/stdlib/source/lux/macro/poly/json.lux
+++ b/stdlib/source/lux/macro/poly/json.lux
@@ -30,10 +30,8 @@
["s" syntax (#+ syntax:)]
["." code]
["." poly (#+ poly:)]]
- [type
- ["." unit]]
- [language
- ["." type]]])
+ ["." type
+ ["." unit]]])
(def: tag
(-> Nat Frac)
diff --git a/stdlib/source/lux/language/type.lux b/stdlib/source/lux/type.lux
index 9d774198d..9d774198d 100644
--- a/stdlib/source/lux/language/type.lux
+++ b/stdlib/source/lux/type.lux
diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux
index bf17562da..7dd65b106 100644
--- a/stdlib/source/lux/type/abstract.lux
+++ b/stdlib/source/lux/type/abstract.lux
@@ -16,8 +16,7 @@
[common
["csr" reader]
["csw" writer]]]]
- [language
- [type (#+ :cast)]]])
+ [type (#+ :cast)]])
(def: (get k plist)
(All [a]
diff --git a/stdlib/source/lux/language/type/check.lux b/stdlib/source/lux/type/check.lux
index 3f9812d0b..7e77b0bb6 100644
--- a/stdlib/source/lux/language/type/check.lux
+++ b/stdlib/source/lux/type/check.lux
@@ -8,15 +8,13 @@
[data
["." maybe]
["." product]
- ["e" error]
+ ["." error (#+ Error)]
["." number ("nat/." Codec<Text,Nat>)]
[text ("text/." Monoid<Text> Equivalence<Text>)]
[collection
["." list]
- ["." set (#+ Set)]]]
- [language
- ["." type ("type/." Equivalence<Type>)]]
- ])
+ ["." set (#+ Set)]]]]
+ ["." // ("type/." Equivalence<Type>)])
(exception: #export (unknown-type-var {id Nat})
(nat/encode id))
@@ -25,16 +23,16 @@
(nat/encode id))
(exception: #export (invalid-type-application {funcT Type} {argT Type})
- (type.to-text (#.Apply argT funcT)))
+ (//.to-text (#.Apply argT funcT)))
(exception: #export (cannot-rebind-var {id Nat} {type Type} {bound Type})
(ex.report ["Var" (nat/encode id)]
- ["Wanted Type" (type.to-text type)]
- ["Current Type" (type.to-text bound)]))
+ ["Wanted Type" (//.to-text type)]
+ ["Current Type" (//.to-text bound)]))
(exception: #export (type-check-failed {expected Type} {actual Type})
- (ex.report ["Expected" (type.to-text expected)]
- ["Actual" (type.to-text actual)]))
+ (ex.report ["Expected" (//.to-text expected)]
+ ["Actual" (//.to-text actual)]))
(type: #export Var Nat)
@@ -43,7 +41,7 @@
#verdict Bit})
(type: #export (Check a)
- (-> Type-Context (e.Error [Type-Context a])))
+ (-> Type-Context (Error [Type-Context a])))
(type: #export Type-Vars
(List [Var (Maybe Type)]))
@@ -52,11 +50,11 @@
(def: (map f fa)
(function (_ context)
(case (fa context)
- (#e.Error error)
- (#e.Error error)
+ (#error.Error error)
+ (#error.Error error)
- (#e.Success [context' output])
- (#e.Success [context' (f output)])
+ (#error.Success [context' output])
+ (#error.Success [context' (f output)])
))))
(structure: #export _ (Apply Check)
@@ -65,16 +63,16 @@
(def: (apply ff fa)
(function (_ context)
(case (ff context)
- (#e.Success [context' f])
+ (#error.Success [context' f])
(case (fa context')
- (#e.Success [context'' a])
- (#e.Success [context'' (f a)])
+ (#error.Success [context'' a])
+ (#error.Success [context'' (f a)])
- (#e.Error error)
- (#e.Error error))
+ (#error.Error error)
+ (#error.Error error))
- (#e.Error error)
- (#e.Error error)
+ (#error.Error error)
+ (#error.Error error)
)))
)
@@ -83,21 +81,21 @@
(def: (wrap x)
(function (_ context)
- (#e.Success [context x])))
+ (#error.Success [context x])))
(def: (join ffa)
(function (_ context)
(case (ffa context)
- (#e.Success [context' fa])
+ (#error.Success [context' fa])
(case (fa context')
- (#e.Success [context'' a])
- (#e.Success [context'' a])
+ (#error.Success [context'' a])
+ (#error.Success [context'' a])
- (#e.Error error)
- (#e.Error error))
+ (#error.Error error)
+ (#error.Error error))
- (#e.Error error)
- (#e.Error error)
+ (#error.Error error)
+ (#error.Error error)
)))
)
@@ -151,13 +149,13 @@
## [[Logic]]
(def: #export (run context proc)
- (All [a] (-> Type-Context (Check a) (e.Error a)))
+ (All [a] (-> Type-Context (Check a) (Error a)))
(case (proc context)
- (#e.Error error)
- (#e.Error error)
+ (#error.Error error)
+ (#error.Error error)
- (#e.Success [context' output])
- (#e.Success output)))
+ (#error.Success [context' output])
+ (#error.Success output)))
(def: #export (throw exception message)
(All [e a] (-> (ex.Exception e) e (Check a)))
@@ -169,8 +167,8 @@
(Check [Nat Type])
(function (_ context)
(let [id (get@ #.ex-counter context)]
- (#e.Success [(update@ #.ex-counter inc context)
- [id (#.Ex id)]]))))
+ (#error.Success [(update@ #.ex-counter inc context)
+ [id (#.Ex id)]]))))
(do-template [<name> <outputT> <fail> <succeed>]
[(def: #export (<name> id)
@@ -179,10 +177,10 @@
(case (|> context (get@ #.var-bindings) (var::get id))
(^or (#.Some (#.Some (#.Var _)))
(#.Some #.None))
- (#e.Success [context <fail>])
+ (#error.Success [context <fail>])
(#.Some (#.Some bound))
- (#e.Success [context <succeed>])
+ (#error.Success [context <succeed>])
#.None
(ex.throw unknown-type-var id))))]
@@ -196,7 +194,7 @@
(function (_ context)
(case (|> context (get@ #.var-bindings) (var::get id))
(#.Some (#.Some bound))
- (#e.Success [context bound])
+ (#error.Success [context bound])
(#.Some #.None)
(ex.throw unbound-type-var id)
@@ -212,8 +210,8 @@
(ex.throw cannot-rebind-var [id type bound])
(#.Some #.None)
- (#e.Success [(update@ #.var-bindings (var::put id (#.Some type)) context)
- []])
+ (#error.Success [(update@ #.var-bindings (var::put id (#.Some type)) context)
+ []])
#.None
(ex.throw unknown-type-var id))))
@@ -223,8 +221,8 @@
(function (_ context)
(case (|> context (get@ #.var-bindings) (var::get id))
(#.Some _)
- (#e.Success [(update@ #.var-bindings (var::put id (#.Some type)) context)
- []])
+ (#error.Success [(update@ #.var-bindings (var::put id (#.Some type)) context)
+ []])
#.None
(ex.throw unknown-type-var id))))
@@ -233,22 +231,22 @@
(Check [Var Type])
(function (_ context)
(let [id (get@ #.var-counter context)]
- (#e.Success [(|> context
- (update@ #.var-counter inc)
- (update@ #.var-bindings (var::new id)))
- [id (#.Var id)]]))))
+ (#error.Success [(|> context
+ (update@ #.var-counter inc)
+ (update@ #.var-bindings (var::new id)))
+ [id (#.Var id)]]))))
(def: get-bindings
(Check (List [Var (Maybe Type)]))
(function (_ context)
- (#e.Success [context
- (get@ #.var-bindings context)])))
+ (#error.Success [context
+ (get@ #.var-bindings context)])))
(def: (set-bindings value)
(-> (List [Var (Maybe Type)]) (Check Any))
(function (_ context)
- (#e.Success [(set@ #.var-bindings value context)
- []])))
+ (#error.Success [(set@ #.var-bindings value context)
+ []])))
(def: (apply-type! funcT argT)
(-> Type Type (Check Type))
@@ -265,12 +263,12 @@
_
(function (_ context)
- (case (type.apply (list argT) funcT)
+ (case (//.apply (list argT) funcT)
#.None
(ex.throw invalid-type-application [funcT argT])
(#.Some output)
- (#e.Success [context output])))))
+ (#error.Success [context output])))))
(type: #export Ring (Set Var))
@@ -286,14 +284,14 @@
(case type
(#.Var post)
(if (n/= id post)
- (#e.Success [context output])
+ (#error.Success [context output])
(recur post (set.add post output)))
_
- (#e.Success [context empty-ring]))
+ (#error.Success [context empty-ring]))
(#.Some #.None)
- (#e.Success [context output])
+ (#error.Success [context output])
#.None
(ex.throw unknown-type-var current)))))
@@ -309,32 +307,32 @@
(All [a] (-> (Check a) (Check (Maybe a))))
(function (_ context)
(case (op context)
- (#e.Success [context' output])
- (#e.Success [context' (#.Some output)])
+ (#error.Success [context' output])
+ (#error.Success [context' (#.Some output)])
- (#e.Error _)
- (#e.Success [context #.None]))))
+ (#error.Error _)
+ (#error.Success [context #.None]))))
(def: #export (fail message)
(All [a] (-> Text (Check a)))
(function (_ context)
- (#e.Error message)))
+ (#error.Error message)))
(def: #export (assert message test)
(-> Text Bit (Check Any))
(function (_ context)
(if test
- (#e.Success [context []])
- (#e.Error message))))
+ (#error.Success [context []])
+ (#error.Error message))))
(def: (either left right)
(All [a] (-> (Check a) (Check a) (Check a)))
(function (_ context)
(case (left context)
- (#e.Success [context' output])
- (#e.Success [context' output])
+ (#error.Success [context' output])
+ (#error.Success [context' output])
- (#e.Error _)
+ (#error.Error _)
(right context))))
(def: (assumed? [e a] assumptions)
@@ -454,16 +452,16 @@
(All [a] (-> (-> Any Text) (Check a) (Check a)))
(function (_ context)
(case (check context)
- (#e.Error error)
- (#e.Error (case error
- ""
- (on-error [])
-
- _
- ($_ text/compose
+ (#error.Error error)
+ (#error.Error (case error
+ ""
(on-error [])
- "\n\n-----------------------------------------\n\n"
- error)))
+
+ _
+ ($_ text/compose
+ (on-error [])
+ "\n\n-----------------------------------------\n\n"
+ error)))
output
output)))
@@ -636,16 +634,16 @@
{#.doc "A simple type-checking function that just returns a yes/no answer."}
(-> Type Type Bit)
(case (run fresh-context (check expected actual))
- (#e.Error error)
+ (#error.Error error)
#0
- (#e.Success _)
+ (#error.Success _)
#1))
(def: #export context
(Check Type-Context)
(function (_ context)
- (#e.Success [context context])))
+ (#error.Success [context context])))
(def: #export (clean inputT)
(-> Type (Check Type))
diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux
index c4f025f4f..f8be1a83f 100644
--- a/stdlib/source/lux/type/implicit.lux
+++ b/stdlib/source/lux/type/implicit.lux
@@ -16,9 +16,8 @@
["." macro (#+ Monad<Meta>)
["." code]
["s" syntax (#+ syntax: Syntax)]]
- [language
- ["." type
- ["." check (#+ Check)]]]])
+ ["." type
+ ["." check (#+ Check)]]])
(def: (find-type-var id env)
(-> Nat Type-Context (Meta Type))
diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux
index 94d42a28a..cb92c7253 100644
--- a/stdlib/source/lux/type/object/interface.lux
+++ b/stdlib/source/lux/type/object/interface.lux
@@ -12,6 +12,7 @@
[collection
["." list ("list/." Functor<List> Fold<List> Monoid<List>)]
["." set (#+ Set)]]]
+ ["." type]
["." macro (#+ Monad<Meta>) ("meta/." Monad<Meta>)
["." code]
["s" syntax (#+ syntax:)]
@@ -19,9 +20,7 @@
["cs" common]
[common
["csr" reader]
- ["csw" writer]]]]
- [language
- ["." type]]])
+ ["csw" writer]]]]])
## [Common]
(type: Declaration
diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux
index 63d022a31..8f22f4702 100644
--- a/stdlib/source/lux/type/quotient.lux
+++ b/stdlib/source/lux/type/quotient.lux
@@ -5,9 +5,7 @@
["p" parser]]
[data
["e" error (#+ Error)]]
- [language
- ["." type]]
- [type
+ ["." type
abstract]
["." macro
["s" syntax (#+ syntax:)]
diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux
index 670a3101e..dd8664236 100644
--- a/stdlib/source/lux/type/refinement.lux
+++ b/stdlib/source/lux/type/refinement.lux
@@ -6,9 +6,7 @@
["p" parser]]
[data
["e" error (#+ Error)]]
- [language
- ["." type ("type/." Equivalence<Type>)]]
- [type
+ ["." type ("type/." Equivalence<Type>)
abstract]
["." macro
["s" syntax (#+ syntax:)]
diff --git a/stdlib/test/test/lux/language/compiler/analysis/case.lux b/stdlib/test/test/lux/language/compiler/analysis/case.lux
index 183ae7da7..5956cc48e 100644
--- a/stdlib/test/test/lux/language/compiler/analysis/case.lux
+++ b/stdlib/test/test/lux/language/compiler/analysis/case.lux
@@ -12,11 +12,11 @@
["." set]]]
[math
["r" random ("random/." Monad<Random>)]]
+ ["." type
+ ["." check]]
[macro
["." code]]
[language
- ["." type
- ["." check]]
["." compiler
["." analysis
["." module]
diff --git a/stdlib/test/test/lux/language/compiler/analysis/function.lux b/stdlib/test/test/lux/language/compiler/analysis/function.lux
index 559a4a841..22ff04213 100644
--- a/stdlib/test/test/lux/language/compiler/analysis/function.lux
+++ b/stdlib/test/test/lux/language/compiler/analysis/function.lux
@@ -13,10 +13,10 @@
["." list ("list/." Functor<List>)]]]
[math
["r" random]]
+ ["." type]
["." macro
["." code]]
["." language
- ["." type]
["." reference]
["." compiler
["." init]
diff --git a/stdlib/test/test/lux/language/compiler/analysis/primitive.lux b/stdlib/test/test/lux/language/compiler/analysis/primitive.lux
index e49284c1a..adad90f18 100644
--- a/stdlib/test/test/lux/language/compiler/analysis/primitive.lux
+++ b/stdlib/test/test/lux/language/compiler/analysis/primitive.lux
@@ -10,10 +10,10 @@
format]]
[math
["r" random ("random/." Monad<Random>)]]
+ [".L" type ("type/." Equivalence<Type>)]
[macro
["." code]]
["." language
- [".L" type ("type/." Equivalence<Type>)]
["." compiler
["." init]
["." analysis (#+ Analysis Operation)
diff --git a/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux b/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux
index 92afb7083..2a5cc2ee3 100644
--- a/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux
+++ b/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux
@@ -13,10 +13,10 @@
format]]
[math
["r" random]]
+ [type ("type/." Equivalence<Type>)]
[macro
["." code]]
[language
- [type ("type/." Equivalence<Type>)]
["." compiler
["." init]
[analysis
diff --git a/stdlib/test/test/lux/language/compiler/analysis/reference.lux b/stdlib/test/test/lux/language/compiler/analysis/reference.lux
index ac302db3e..66c990ef4 100644
--- a/stdlib/test/test/lux/language/compiler/analysis/reference.lux
+++ b/stdlib/test/test/lux/language/compiler/analysis/reference.lux
@@ -9,11 +9,10 @@
[text ("text/." Equivalence<Text>)]]
[math
["r" random]]
+ [type ("type/." Equivalence<Type>)]
[macro
["." code]]
- ["." language]
- [language
- [type ("type/." Equivalence<Type>)]
+ ["." language
["." reference]
["." compiler
["." init]
diff --git a/stdlib/test/test/lux/language/compiler/analysis/structure.lux b/stdlib/test/test/lux/language/compiler/analysis/structure.lux
index c3c5a0dc2..6dca4fb12 100644
--- a/stdlib/test/test/lux/language/compiler/analysis/structure.lux
+++ b/stdlib/test/test/lux/language/compiler/analysis/structure.lux
@@ -14,11 +14,11 @@
["." set]]]
[math
["r" random]]
+ ["." type ("type/." Equivalence<Type>)
+ ["." check]]
[macro
["." code]]
["." language
- ["." type ("type/." Equivalence<Type>)
- ["." check]]
["." compiler
["." init]
["." analysis (#+ Analysis Variant Tag Operation)
diff --git a/stdlib/test/test/lux/math/modular.lux b/stdlib/test/test/lux/math/modular.lux
index cd1f637e9..ad9fda295 100644
--- a/stdlib/test/test/lux/math/modular.lux
+++ b/stdlib/test/test/lux/math/modular.lux
@@ -11,8 +11,7 @@
[math
["r" random]
["/" modular]]
- [language
- [type ("type/." Equivalence<Type>)]]]
+ [type ("type/." Equivalence<Type>)]]
lux/test)
(def: %3 (/.modulus 3))
diff --git a/stdlib/test/test/lux/language/type.lux b/stdlib/test/test/lux/type.lux
index 8db1c5a19..9592170ff 100644
--- a/stdlib/test/test/lux/language/type.lux
+++ b/stdlib/test/test/lux/type.lux
@@ -11,8 +11,7 @@
["." list]]]
[math
["r" random]]
- [language
- ["&" type]]]
+ ["&" type]]
lux/test)
## [Utils]
diff --git a/stdlib/test/test/lux/language/type/check.lux b/stdlib/test/test/lux/type/check.lux
index a8cf1963f..c817ec61e 100644
--- a/stdlib/test/test/lux/language/type/check.lux
+++ b/stdlib/test/test/lux/type/check.lux
@@ -13,9 +13,8 @@
["." set]]]
[math
["r" random]]
- [language
- ["." type ("type/." Equivalence<Type>)
- ["@" check]]]]
+ ["." type ("type/." Equivalence<Type>)
+ ["@" check]]]
lux/test)
## [Utils]
diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux
index a795556eb..bdd8ef0ab 100644
--- a/stdlib/test/tests.lux
+++ b/stdlib/test/tests.lux
@@ -143,7 +143,8 @@
[poly
["poly_." equivalence]
["poly_." functor]]]
- [type
+ ["_." type
+ ["_." check]
## ["_." implicit] ## TODO: Specially troublesome...
["_." resource]
[object
@@ -151,8 +152,6 @@
["_." protocol]]]
[language
["_language/." syntax]
- ["_." type
- ["_." check]]
[compiler
[analysis
["_.A" primitive]