diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/meta/macro/context.lux | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/stdlib/source/library/lux/meta/macro/context.lux b/stdlib/source/library/lux/meta/macro/context.lux index dc2911506..9db9ef978 100644 --- a/stdlib/source/library/lux/meta/macro/context.lux +++ b/stdlib/source/library/lux/meta/macro/context.lux @@ -24,7 +24,7 @@ (type .public Stack List) -(exception.def .public (no_definition it) +(exception.def (no_definition it) (Exception Symbol) (exception.report (list ["Definition" (symbol#encoded it)]))) @@ -66,8 +66,8 @@ (exception.def .public no_example) -(.def .public (search' _ ? context) - (All (_ a) (-> (Stack a) (Predicate a) Symbol (Meta a))) +(.def .public (search' ? _ context) + (All (_ a) (-> (Predicate a) (Stack a) Symbol (Meta a))) (do meta.monad [stack (..global context)] (when (|> stack @@ -80,9 +80,9 @@ (meta.failure (exception.error ..no_example []))))) (.def .public search - (syntax (_ [g!context (at ?.monad each code.symbol ?code.global) - g!? ?code.any]) - (in (list (` (..search' (, g!context) (, g!?) (.symbol (, g!context)))))))) + (syntax (_ [g!? ?code.any + g!context (at ?.monad each code.symbol ?code.global)]) + (in (list (` (..search' (, g!?) (, g!context) (.symbol (, g!context)))))))) (.def (alter on_definition [@ context]) (-> (-> Definition Definition) Symbol (Meta Any)) @@ -102,8 +102,8 @@ {.#Right [(revised .#modules (property.revised @ on_module) lux) []]}))) -(.def .public (push' _ top) - (All (_ a) (-> (Stack a) a Symbol (Meta Any))) +(.def .public (push' top _) + (All (_ a) (-> a (Stack a) Symbol (Meta Any))) (alter (function (_ [exported? type stack]) (|> stack (as (Stack Any)) @@ -112,25 +112,29 @@ [exported? type])))) (.def .public push - (syntax (_ [g!context (at ?.monad each code.symbol ?code.global) - g!it ?code.any]) - (in (list (` (..push' (, g!context) (, g!it) (.symbol (, g!context)))))))) + (syntax (_ [g!it ?code.any + g!context (at ?.monad each code.symbol ?code.global)]) + (in (list (` (..push' (, g!it) (, g!context) (.symbol (, g!context)))))))) -(.def pop' +(.def .public pop'' (-> Symbol (Meta Any)) (alter (function (_ [exported? type value]) [exported? type (let [value (as (Stack Any) value)] (maybe.else value (list.tail value)))]))) -(.def .public pop +(.def .public pop' (syntax (_ [expression? ?code.bit context ?code.global]) (do meta.monad - [_ (..pop' context)] + [_ (..pop'' context)] (in (if expression? (list (' [])) (list)))))) +(.def .public pop + (syntax (_ [g!context (at ?.monad each code.symbol ?code.global)]) + (in (list (` (..pop'' (.symbol (, g!context)))))))) + (.def .public def (syntax (_ [.let [! ?.monad ?local (at ! each code.local ?code.local)] @@ -146,14 +150,14 @@ (` (.def ((, g!expression) (, g!it) (, g!body)) (-> (, context_type) Code (Meta Code)) (do meta.monad - [(, g!_) (..push (, g!context) (, g!it))] + [(, g!_) (..push (, g!it) (, g!context))] ((,' in) (` (let [((,' ,') (, g!body)) ((,' ,) (, g!body)) - ((,' ,') (, g!_)) (..pop #1 (, g!context))] + ((,' ,') (, g!_)) (..pop' #1 (, g!context))] ((,' ,') (, g!body)))))))) (` (.def ((, g!declaration) (, g!it) (, g!body)) (-> (, context_type) Code (Meta (List Code))) (do meta.monad - [(, g!_) (..push (, g!context) (, g!it))] + [(, g!_) (..push (, g!it) (, g!context))] ((,' in) (list (, g!body) - (` (..pop #0 (, g!context)))))))) + (` (..pop' #0 (, g!context)))))))) )))))) |