diff options
20 files changed, 40 insertions, 31 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index b50d4ac55..a4550d7af 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -381,7 +381,7 @@ Called by `imenu--generic-function'." (type//capability (altRE "capability:")) ;; Data (data//record (altRE "the" "has" "revised")) - (data//interface (altRE "open:" "implementation" "at")) + (data//interface (altRE "open:" "implementation" "with" "at")) (data//implicit (altRE "implicit:" "a/an" "a" "an")) (data//collection (altRE "list" "partial_list" "sequence" "tree")) ;; Code diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index cdcb304a0..1c550ec22 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -4264,11 +4264,20 @@ _ (failure (..wrong_syntax_error (symbol ..refer))))) +(macro: .public (with tokens) + (case (..parsed (..andP ..anyP ..anyP) + tokens) + {.#Some [implementation expression]} + (meta#in (list (` (..let [(..open (~ (text$ (alias_stand_in 0)))) (~ implementation)] + (~ expression))))) + + {.#None} + (failure (..wrong_syntax_error (symbol ..with))))) + (macro: .public (at tokens) (case tokens - (pattern (list struct [_ {#Symbol member}])) - (meta#in (list (` (..let [(..open (~ (text$ (alias_stand_in 0)))) (~ struct)] - (~ (symbol$ member)))))) + (pattern (list implementation [_ {#Symbol member}])) + (meta#in (list (` (..with (~ implementation) (~ (symbol$ member)))))) (pattern (partial_list struct member args)) (meta#in (list (` ((..at (~ struct) (~ member)) (~+ args))))) diff --git a/stdlib/source/library/lux/abstract/comonad/cofree.lux b/stdlib/source/library/lux/abstract/comonad/free.lux index 2b4ec2b4e..cba43d06d 100644 --- a/stdlib/source/library/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/library/lux/abstract/comonad/free.lux @@ -5,17 +5,17 @@ [// [functor (.only Functor)]]]) -(type: .public (CoFree F a) - [a (F (CoFree F a))]) +(type: .public (Free F a) + [a (F (Free F a))]) (implementation: .public (functor dsl) - (All (_ F) (-> (Functor F) (Functor (CoFree F)))) + (All (_ F) (-> (Functor F) (Functor (Free F)))) (def: (each f [head tail]) [(f head) (at dsl each (each f) tail)])) (implementation: .public (comonad dsl) - (All (_ F) (-> (Functor F) (CoMonad (CoFree F)))) + (All (_ F) (-> (Functor F) (CoMonad (Free F)))) (def: functor (..functor dsl)) diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 7aed1de63..48276683c 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except except) + [lux (.except except with) ["[0]" macro] ["[0]" meta] [abstract diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index 72b1f30aa..dafd471d1 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except list) + [lux (.except list with) [abstract [monoid (.only Monoid)] [equivalence (.only Equivalence)] diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux index 651ce0eb8..cd2d5b053 100644 --- a/stdlib/source/library/lux/control/reader.lux +++ b/stdlib/source/library/lux/control/reader.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except local) + [lux (.except local with) ["@" target] [abstract [apply (.only Apply)] diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux index b5a87549d..798e42b16 100644 --- a/stdlib/source/library/lux/control/state.lux +++ b/stdlib/source/library/lux/control/state.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except local) + [lux (.except local with) [abstract [functor (.only Functor)] [apply (.only Apply)] diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index dd43a0ea1..897ae0adf 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except) + [lux (.except with) ["@" target] [abstract [apply (.only Apply)] diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index 40540eb04..e08e494d1 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except) + [lux (.except with) ["@" target] [abstract [monoid (.only Monoid)] diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 903d5ae3f..ba1902276 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except revised all only) + [lux (.except revised all only with) ["@" target] [abstract [monoid (.only Monoid)] diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index 640dcee6a..c66147ba8 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except) + [lux (.except with) [abstract [equivalence (.only Equivalence)]]]]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux index 9aabc7d10..1a897fb6c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except Label) + [lux (.except Label with) [abstract ["[0]" monad (.only do)]] [control diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux index bf221d35b..2fa60d94f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except local) + [lux (.except local with) [abstract [monad (.only do)]] [control diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index 493776886..e2fe1fd05 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except) + [lux (.except with) [abstract [equivalence (.only Equivalence)] [hash (.only Hash)] diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index e3cf241ba..480ad7380 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except except) + [lux (.except except with) [abstract [functor (.only Functor)] [monad (.only Monad do)]] diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index 497e0e6cc..4e9a81e48 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except try except) + [lux (.except try except with) ["@" target] [abstract [functor (.only Functor)] diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index fbe04737a..95e9a53dc 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except) + [lux (.except with) [abstract ["[0]" monad (.only do)] ["[0]" equivalence]] diff --git a/stdlib/source/test/lux/abstract.lux b/stdlib/source/test/lux/abstract.lux index 974778af5..b044876aa 100644 --- a/stdlib/source/test/lux/abstract.lux +++ b/stdlib/source/test/lux/abstract.lux @@ -6,7 +6,7 @@ ["[1][0]" apply] ["[1][0]" codec] ["[1][0]" comonad (.only) - ["[1]/[0]" cofree]] + ["[1]/[0]" free]] ["[1][0]" enum] ["[1][0]" equivalence] ["[1][0]" hash] @@ -38,7 +38,7 @@ Test (all _.and /comonad.test - /comonad/cofree.test + /comonad/free.test )) (def: .public test diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/free.lux index 2f2b7569b..9c84654c2 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/free.lux @@ -20,18 +20,18 @@ ["[0]" /]]) (def: (injection value) - (Injection (/.CoFree Stream)) + (Injection (/.Free Stream)) [value (stream#each injection (stream.repeated value))]) (def: (interpret [head tail]) - (All (_ a) (-> (/.CoFree Stream a) (Stream a))) + (All (_ a) (-> (/.Free Stream a) (Stream a))) (|> tail (stream#each (at (/.comonad stream.functor) out)) [head] //.pending)) (def: comparison - (Comparison (/.CoFree Stream)) + (Comparison (/.Free Stream)) (function (_ == left right) (at (list.equivalence ==) = (stream.first 100 (..interpret left)) @@ -40,12 +40,12 @@ (def: .public test Test (<| (_.covering /._) - (_.for [/.CoFree]) + (_.for [/.Free]) (all _.and (_.for [/.functor] - ($functor.spec ..injection ..comparison (is (Functor (/.CoFree Stream)) + ($functor.spec ..injection ..comparison (is (Functor (/.Free Stream)) (/.functor stream.functor)))) (_.for [/.comonad] - ($comonad.spec ..injection ..comparison (is (CoMonad (/.CoFree Stream)) + ($comonad.spec ..injection ..comparison (is (CoMonad (/.Free Stream)) (/.comonad stream.functor)))) ))) diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index 910ffe079..a38dc8be7 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except) + [lux (.except with) ["_" test (.only Test)] ["[0]" meta] [abstract |