aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/type/check.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-03-15 07:24:35 -0400
committerEduardo Julian2022-03-15 07:24:35 -0400
commitbc36487224f670c23002cc4575c0dba3e5dc1be1 (patch)
tree01601f7e5d992ace77a16cfa90240ffc4511a7af /stdlib/source/library/lux/type/check.lux
parent4ef1ac1dfe0edd1a11bb7f1fd13c8b6cb8f1bab4 (diff)
De-sigil-ification: ^
Diffstat (limited to 'stdlib/source/library/lux/type/check.lux')
-rw-r--r--stdlib/source/library/lux/type/check.lux36
1 files changed, 19 insertions, 17 deletions
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index 757eac347..02dd48227 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -16,6 +16,8 @@
[collection
["[0]" list ("[1]#[0]" mix)]
["[0]" set {"+" Set}]]]
+ [macro
+ ["^" pattern]]
[math
[number
["n" nat ("[1]#[0]" decimal)]]]]]
@@ -197,8 +199,8 @@
(-> Var (Check <outputT>))
(function (_ context)
(case (|> context (the .#var_bindings) (var::get id))
- (^or {.#Some {.#Some {.#Var _}}}
- {.#Some {.#None}})
+ (^.or {.#Some {.#Some {.#Var _}}}
+ {.#Some {.#None}})
{try.#Success [context <fail>]}
{.#Some {.#Some bound}}
@@ -383,20 +385,20 @@
(do [! ..monad]
[ring (..ring' @)]
(case ring
- (^ (list))
+ (pattern (list))
(in [])
- (^ (list @me))
+ (pattern (list @me))
(erase! @me)
- (^ (list @other @me))
+ (pattern (list @other @me))
(do !
[_ (re_bind' {.#None} @other)]
(erase! @me))
- (^ (list& @prev _))
+ (pattern (list& @prev _))
(case (list.reversed ring)
- (^ (list& @me @next _))
+ (pattern (list& @me @next _))
(do !
[_ (re_bind {.#Var @next} @prev)
_ (re_bind {.#Var @prev} @next)]
@@ -525,7 +527,7 @@
(set.list ringA))]
(in assumptions))))
- (^template [<pattern> <id> <type>]
+ (^.template [<pattern> <id> <type>]
[<pattern>
(do !
[ring (..ring <id>)
@@ -572,7 +574,7 @@
[actual_function'' (..on actual_input' actual_function')]
(check' assumptions {.#Apply expected} {.#Apply [actual_input actual_function'']}))
- (^or [{.#Ex _} _] [_ {.#Ex _}])
+ (^.or [{.#Ex _} _] [_ {.#Ex _}])
(do ..monad
[assumptions (check' assumptions expected_function actual_function)]
(check' assumptions expected_input actual_input))
@@ -659,7 +661,7 @@
(function (_ bound)
(check' assumptions expected bound)))
- (^template [<fE> <fA>]
+ (^.template [<fE> <fA>]
[[{.#Apply aE <fE>} {.#Apply aA <fA>}]
(check_apply check' assumptions [aE <fE>] [aA <fA>])])
([F1 {.#Ex ex}]
@@ -681,7 +683,7 @@
(check' assumptions expected actual'))
... TODO: Refactor-away as cold-code
- (^template [<tag> <instancer>]
+ (^.template [<tag> <instancer>]
[[{<tag> _} _]
(do ..monad
[[_ paramT] <instancer>
@@ -691,7 +693,7 @@
[.#ExQ ..var])
... TODO: Refactor-away as cold-code
- (^template [<tag> <instancer>]
+ (^.template [<tag> <instancer>]
[[_ {<tag> _}]
(do ..monad
[[_ paramT] <instancer>
@@ -718,7 +720,7 @@
..silent_failure!))
..silent_failure!)
- (^template [<composite>]
+ (^.template [<composite>]
[[{<composite> eL eR} {<composite> aL aR}]
(do ..monad
[assumptions (check' assumptions eL aL)]
@@ -777,10 +779,10 @@
(monad.each ..monad (clean aliases))
(check#each (|>> {.#Primitive name})))
- (^or {.#Parameter _} {.#Ex _} {.#Named _})
+ (^.or {.#Parameter _} {.#Ex _} {.#Named _})
(check#in inputT)
- (^template [<tag>]
+ (^.template [<tag>]
[{<tag> leftT rightT}
(do ..monad
[leftT' (clean aliases leftT)]
@@ -790,7 +792,7 @@
{.#Var @it}
(case aliases
- (^ (list))
+ (pattern (list))
(do ..monad
[?actualT (..peek @it)]
(case ?actualT
@@ -815,7 +817,7 @@
failure
(in inputT))))
- (^template [<tag>]
+ (^.template [<tag>]
[{<tag> envT+ unquantifiedT}
(do [! ..monad]
[envT+' (monad.each ! (clean aliases) envT+)