aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/type/implicit.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/type/implicit.lux')
-rw-r--r--stdlib/source/lux/type/implicit.lux66
1 files changed, 33 insertions, 33 deletions
diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux
index 42db42900..83a8e9998 100644
--- a/stdlib/source/lux/type/implicit.lux
+++ b/stdlib/source/lux/type/implicit.lux
@@ -8,10 +8,10 @@
["." product]
["." maybe]
["." number]
- ["." text ("text/." Equivalence<Text>)
+ ["." text ("text/." equivalence)
format]
[collection
- ["." list ("list/." Monad<List> Fold<List>)]
+ ["." list ("list/." monad fold)]
["dict" dictionary (#+ Dictionary)]]]
["." macro
["." code]
@@ -29,7 +29,7 @@
(find-type-var id' env)
_
- (:: macro.Monad<Meta> wrap type))
+ (:: macro.monad wrap type))
(#.Some [_ #.None])
(macro.fail (format "Unbound type-var " (%n id)))
@@ -40,7 +40,7 @@
(def: (resolve-type var-name)
(-> Name (Meta Type))
- (do macro.Monad<Meta>
+ (do macro.monad
[raw-type (macro.find-type var-name)
compiler macro.get-compiler]
(case raw-type
@@ -66,23 +66,23 @@
(#.Product left right)
(if (n/= 0 idx)
- (:: check.Monad<Check> wrap left)
+ (:: check.monad wrap left)
(find-member-type (dec idx) right))
_
(if (n/= 0 idx)
- (:: check.Monad<Check> wrap sig-type)
+ (:: check.monad wrap sig-type)
(check.fail (format "Cannot find member type " (%n idx) " for " (%type sig-type))))))
(def: (find-member-name member)
(-> Name (Meta Name))
(case member
["" simple-name]
- (macro.either (do macro.Monad<Meta>
+ (macro.either (do macro.monad
[member (macro.normalize member)
_ (macro.resolve-tag member)]
(wrap member))
- (do macro.Monad<Meta>
+ (do macro.monad
[this-module-name macro.current-module-name
imp-mods (macro.imported-modules this-module-name)
tag-lists (monad.map @ macro.tag-lists imp-mods)
@@ -100,11 +100,11 @@
(macro.fail (format "Too many candidate tags: " (%list %name candidates))))))
_
- (:: macro.Monad<Meta> wrap member)))
+ (:: macro.monad wrap member)))
(def: (resolve-member member)
(-> Name (Meta [Nat Type]))
- (do macro.Monad<Meta>
+ (do macro.monad
[member (find-member-name member)
[idx tag-list sig-type] (macro.resolve-tag member)]
(wrap [idx sig-type])))
@@ -119,12 +119,12 @@
(def: local-env
(Meta (List [Name Type]))
- (do macro.Monad<Meta>
+ (do macro.monad
[local-batches macro.locals
#let [total-locals (list/fold (function (_ [name type] table)
(dict.put~ name type table))
(: (Dictionary Text Type)
- (dict.new text.Hash<Text>))
+ (dict.new text.hash))
(list/join local-batches))]]
(wrap (|> total-locals
dict.entries
@@ -132,14 +132,14 @@
(def: local-structs
(Meta (List [Name Type]))
- (do macro.Monad<Meta>
+ (do macro.monad
[this-module-name macro.current-module-name
definitions (macro.definitions this-module-name)]
(wrap (prepare-definitions this-module-name definitions))))
(def: import-structs
(Meta (List [Name Type]))
- (do macro.Monad<Meta>
+ (do macro.monad
[this-module-name macro.current-module-name
imp-mods (macro.imported-modules this-module-name)
export-batches (monad.map @ (function (_ imp-mod)
@@ -156,13 +156,13 @@
(apply-function-type func' arg)
(#.UnivQ _)
- (do check.Monad<Check>
+ (do check.monad
[[id var] check.var]
(apply-function-type (maybe.assume (type.apply (list var) func))
arg))
(#.Function input output)
- (do check.Monad<Check>
+ (do check.monad
[_ (check.check input arg)]
(wrap output))
@@ -173,19 +173,19 @@
(-> Type (Check [(List Nat) Type]))
(case type
(#.UnivQ _)
- (do check.Monad<Check>
+ (do check.monad
[[id var] check.var
[ids final-output] (concrete-type (maybe.assume (type.apply (list var) type)))]
(wrap [(#.Cons id ids)
final-output]))
_
- (:: check.Monad<Check> wrap [(list) type])))
+ (:: check.monad wrap [(list) type])))
(def: (check-apply member-type input-types output-type)
(-> Type (List Type) Type (Check []))
- (do check.Monad<Check>
- [member-type' (monad.fold check.Monad<Check>
+ (do check.monad
+ [member-type' (monad.fold check.monad
(function (_ input member)
(apply-function-type member input))
member-type
@@ -200,12 +200,12 @@
(-> (-> Lux Type-Context Type (Check Instance))
Type-Context Type (List [Name Type])
(Meta (List Instance)))
- (do macro.Monad<Meta>
+ (do macro.monad
[compiler macro.get-compiler]
(case (|> alts
(list/map (function (_ [alt-name alt-type])
(case (check.run context
- (do check.Monad<Check>
+ (do check.monad
[[tvars alt-type] (concrete-type alt-type)
#let [[deps alt-type] (type.flatten-function alt-type)]
_ (check.check dep alt-type)
@@ -228,9 +228,9 @@
(-> Lux Type-Context Type (Check Instance))
(case (macro.run compiler
($_ macro.either
- (do macro.Monad<Meta> [alts local-env] (test-provision provision context dep alts))
- (do macro.Monad<Meta> [alts local-structs] (test-provision provision context dep alts))
- (do macro.Monad<Meta> [alts import-structs] (test-provision provision context dep alts))))
+ (do macro.monad [alts local-env] (test-provision provision context dep alts))
+ (do macro.monad [alts local-structs] (test-provision provision context dep alts))
+ (do macro.monad [alts import-structs] (test-provision provision context dep alts))))
(#.Left error)
(check.fail error)
@@ -240,7 +240,7 @@
(check.fail (format "No candidates for provisioning: " (%type dep)))
(#.Cons winner #.Nil)
- (:: check.Monad<Check> wrap winner)
+ (:: check.monad wrap winner)
_
(check.fail (format "Too many candidates for provisioning: " (%type dep) " --- " (%list (|>> product.left %name) candidates))))
@@ -248,13 +248,13 @@
(def: (test-alternatives sig-type member-idx input-types output-type alts)
(-> Type Nat (List Type) Type (List [Name Type]) (Meta (List Instance)))
- (do macro.Monad<Meta>
+ (do macro.monad
[compiler macro.get-compiler
context macro.type-context]
(case (|> alts
(list/map (function (_ [alt-name alt-type])
(case (check.run context
- (do check.Monad<Check>
+ (do check.monad
[[tvars alt-type] (concrete-type alt-type)
#let [[deps alt-type] (type.flatten-function alt-type)]
_ (check.check alt-type sig-type)
@@ -279,9 +279,9 @@
(-> Type Nat (List Type) Type (Meta (List Instance)))
(let [test (test-alternatives sig-type member-idx input-types output-type)]
($_ macro.either
- (do macro.Monad<Meta> [alts local-env] (test alts))
- (do macro.Monad<Meta> [alts local-structs] (test alts))
- (do macro.Monad<Meta> [alts import-structs] (test alts)))))
+ (do macro.monad [alts local-env] (test alts))
+ (do macro.monad [alts local-structs] (test alts))
+ (do macro.monad [alts import-structs] (test alts)))))
(def: (var? input)
(-> Code Bit)
@@ -320,7 +320,7 @@
"a compile-time error will be raised, to alert the user."
"Examples:"
"Nat equivalence"
- (:: number.Equivalence<Nat> = x y)
+ (:: number.equivalence = x y)
(::: = x y)
"Can optionally add the prefix of the module where the signature was defined."
(::: eq.= x y)
@@ -366,7 +366,7 @@
(-> Nat (Meta (List Code)))
(|> (macro.gensym "g!implicit")
(list.repeat amount)
- (monad.seq macro.Monad<Meta>)))
+ (monad.seq macro.monad)))
(def: implicits
(Syntax (List Code))