diff options
203 files changed, 1107 insertions, 679 deletions
diff --git a/commands.md b/commands.md index 89eebb4c2..66256461f 100644 --- a/commands.md +++ b/commands.md @@ -30,13 +30,16 @@ cd ~/lux/lux-r/ && lein clean ## Build & install ``` -cd ~/lux/lux-bootstrapper/ && lein clean && lein install +cd ~/lux/lux-bootstrapper/ \ +&& lein clean \ +&& lein install ``` ## Run JBE (Read generated bytecode) ``` -cd ~/lux/jbe/bin/ && java ee.ioc.cs.jbe.browser.BrowserApplication +cd ~/lux/jbe/bin/ \ +&& java ee.ioc.cs.jbe.browser.BrowserApplication ``` --- @@ -46,8 +49,9 @@ cd ~/lux/jbe/bin/ && java ee.ioc.cs.jbe.browser.BrowserApplication ## Test ``` -cd ~/lux/stdlib/ && lein clean && lein with-profile bibliotheca lux auto test -cd ~/lux/stdlib/ && lein with-profile bibliotheca lux auto test +cd ~/lux/stdlib/ \ +&& lein clean \ +&& lein with-profile bibliotheca lux auto test ``` ## Deploy @@ -69,7 +73,9 @@ cd ~/lux/stdlib/ && mvn deploy:deploy-file \ ## Generate documentation ``` -cd ~/lux/stdlib/ && lein clean && lein with-profile scriptum lux auto build +cd ~/lux/stdlib/ \ +&& lein clean \ +&& lein with-profile scriptum lux auto build ``` --- @@ -79,13 +85,17 @@ cd ~/lux/stdlib/ && lein clean && lein with-profile scriptum lux auto build ## Build ``` -cd ~/lux/stdlib/ && lein clean && lein with-profile aedifex lux auto build +cd ~/lux/stdlib/ \ +&& lein clean \ +&& lein with-profile aedifex lux auto build ``` ## Test ``` -cd ~/lux/stdlib/ && lein clean && lein with-profile aedifex lux auto test +cd ~/lux/stdlib/ \ +&& lein clean \ +&& lein with-profile aedifex lux auto test ``` --- diff --git a/documentation/bookmark/inspiration.md b/documentation/bookmark/inspiration.md index 6eaa9ac34..dfef668ad 100644 --- a/documentation/bookmark/inspiration.md +++ b/documentation/bookmark/inspiration.md @@ -1,5 +1,6 @@ # Possibility +1. [Lambda World 2018 - What FP can learn from Smalltalk by Aditya Siram](https://www.youtube.com/watch?v=baxtyeFVn3w) 1. ["What next?"](https://graydon.livejournal.com/256533.html) && ["What next?"](https://graydon2.dreamwidth.org/253769.html) 1. [A Case for a Native Runtime Compilation Language](https://jott.live/markdown/dynamic_compilation) diff --git a/documentation/bookmark/testing.md b/documentation/bookmark/testing.md index 4a1930de2..56a93fc38 100644 --- a/documentation/bookmark/testing.md +++ b/documentation/bookmark/testing.md @@ -18,3 +18,7 @@ 1. [Visual Testing Handbook](https://storybook.js.org/tutorials/visual-testing-handbook/) +# Cross-Branch Testing + +1. [Cross-Branch Testing](https://www.hillelwayne.com/post/cross-branch-testing/) + diff --git a/documentation/bookmark/web_framework.md b/documentation/bookmark/web_framework.md index 54866447a..48d7e827c 100644 --- a/documentation/bookmark/web_framework.md +++ b/documentation/bookmark/web_framework.md @@ -1,5 +1,6 @@ # Virtual DOM +1. [Virtual DOM is pure overhead](https://svelte.dev/blog/virtual-dom-is-pure-overhead) 1. [million: <1kb virtual DOM - it's fast!](https://million.js.org/) 1. [Optimal Virtual DOM](https://blog.kabir.sh/posts/optimal-virtual-dom.html) @@ -9,6 +10,7 @@ # Reference +1. [You can't capture the nuance of my form fields](https://drewdevault.com/2021/06/27/You-cant-capture-the-nuance.html) 1. [Line-tracking using plain CSS](https://bubblin.io/blog/line-tracking) 1. [Redux is half of a pattern (1/2)](https://dev.to/davidkpiano/redux-is-half-of-a-pattern-1-2-1hd7) 1. [Introducing Concurrent Mode (Experimental)](https://reactjs.org/docs/concurrent-mode-intro.html) diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 41b09da2c..171f92c6e 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -478,7 +478,7 @@ (io (let [interpreter (javax/script/ScriptEngineFactory::getScriptEngine (org/openjdk/nashorn/api/scripting/NashornScriptEngineFactory::new))] (: (Host _.Expression _.Statement) - (structure + (implementation (def: evaluate! (..evaluate! interpreter)) (def: execute! (..execute! interpreter)) (def: define! (..define! interpreter)) @@ -536,7 +536,7 @@ (def: host (IO (Host _.Expression _.Statement)) (io (: (Host _.Expression _.Statement) - (structure + (implementation (def: evaluate! ..evaluate!) (def: execute! ..execute!) (def: define! ..define!) diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index fe651adac..7b5df9f08 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -155,7 +155,7 @@ (io (let [library (loader.new_library []) loader (loader.memory library)] (: Host - (structure + (implementation (def: (evaluate! context valueI) (\ try.monad map product.left (..evaluate! library loader context valueI))) diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index b581ce7bd..40a076e27 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -543,7 +543,7 @@ _ (try.assume (run! ..rembulan_prelude))] [[state_context executor] (: (Host _.Expression _.Statement) - (structure + (implementation (def: (evaluate! context code) (run! (_.return code))) @@ -580,7 +580,7 @@ [] output))))))] (: (Host _.Expression _.Statement) - (structure + (implementation (def: (evaluate! context code) (run! (_.return code))) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 530a5be4e..7dc82baed 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -334,7 +334,7 @@ Called by `imenu--generic-function'." (type//capability (altRE "capability:")) ;; Data (data//record (altRE "get@" "set@" "update@")) - (data//signature (altRE "open:" "structure" "\\\\")) + (data//interface (altRE "open:" "implementation" "\\\\")) (data//implicit (altRE "implicit:" "\\\\\\\\")) (data//collection (altRE "list" "list&" "row" "tree")) ;; Code @@ -351,7 +351,7 @@ Called by `imenu--generic-function'." (remember (altRE "remember" "to_do" "fix_me")) (definition (altRE "\\.module:" "def:" "type:" "program:" - "signature:" "structure:" + "interface:" "implementation:" "macro:" "syntax:" "exception:" "word:" @@ -368,7 +368,7 @@ Called by `imenu--generic-function'." type//dynamic type//capability)) (data (altRE data//record - data//signature + data//interface data//implicit data//collection)) (code (altRE code//quotation diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index 0eac5a354..c014e8386 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -269,7 +269,7 @@ (function (execute! input) (org/python/util/PythonInterpreter::exec (_.code input) interpreter)))] (: (Host (_.Expression Any) (_.Statement Any)) - (structure + (implementation (def: evaluate! evaluate!) (def: execute! execute!) (def: (define! context input) @@ -318,7 +318,7 @@ _ (execute! definition) value (evaluate! context @global)] (wrap [global value definition])))))] - (structure + (implementation (def: evaluate! evaluate!) (def: execute! execute!) (def: define! define!) diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 6bfae1f33..534a59e70 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -589,7 +589,7 @@ (..read (maybe.default (:coerce java/lang/Object []) output)))))] (: (Host _.Expression _.Statement) - (structure + (implementation (def: (evaluate! context code) (run! code)) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index ff676e592..be6755ebe 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1517,7 +1517,7 @@ (fail "Wrong syntax for $_")} tokens)) -## (signature: (Monad m) +## (interface: (Monad m) ## (: (All [a] (-> a (m a))) ## wrap) ## (: (All [a b] (-> (-> a (m b)) (m a) (m b))) @@ -3131,10 +3131,10 @@ #None (fail "Wrong syntax for macro:")))) -(macro: #export (signature: tokens) +(macro: #export (interface: tokens) {#.doc (text$ ($_ "lux text concat" "## Definition of signatures ala ML." ..\n - "(signature: #export (Ord a)" ..\n + "(interface: #export (Ord a)" ..\n " (: (Equivalence a)" ..\n " eq)" ..\n " (: (-> a a Bit)" ..\n @@ -3195,7 +3195,7 @@ (return (list (` (..type: (~+ (export exported?)) (~ usage) (~ sig_meta) (~ sig_type)))))) #None - (fail "Wrong syntax for signature:")))) + (fail "Wrong syntax for interface:")))) (def: (find f xs) (All [a b] @@ -3483,8 +3483,8 @@ #None (#Left "Not expecting any type."))))) -(macro: #export (structure tokens) - {#.doc "Not meant to be used directly. Prefer 'structure:'."} +(macro: #export (implementation tokens) + {#.doc "Not meant to be used directly. Prefer 'implementation:'."} (do meta_monad [tokens' (monad\map meta_monad macro_expand tokens) struct_type get_expected_type @@ -3509,10 +3509,10 @@ (wrap [tag value]) _ - (fail (text\compose "Unknown structure member: " tag_name))) + (fail (text\compose "Unknown implementation member: " tag_name))) _ - (fail "Invalid structure member.")))) + (fail "Invalid implementation member.")))) (list\join tokens'))] (wrap (list (record$ members))))) @@ -3528,10 +3528,10 @@ head tail))) -(macro: #export (structure: tokens) +(macro: #export (implementation: tokens) {#.doc (text$ ($_ "lux text concat" "## Definition of structures ala ML." ..\n - "(structure: #export order (Order Int)" ..\n + "(implementation: #export order (Order Int)" ..\n " (def: &equivalence equivalence)" ..\n " (def: (< test subject)" ..\n " (< test subject))" ..\n @@ -3569,13 +3569,13 @@ _ (` ((~ name) (~+ args))))] (return (list (` (..def: (~+ (export exported?)) (~ usage) - (~ (meta_code_merge (` {#.struct? #1}) + (~ (meta_code_merge (` {#.implementation? #1}) meta)) (~ type) - (structure (~+ definitions))))))) + (implementation (~+ definitions))))))) #None - (fail "Wrong syntax for structure:")))) + (fail "Wrong syntax for implementation:")))) (def: (function\identity x) (All [a] (-> a a)) x) @@ -3751,7 +3751,7 @@ (return struct_name) _ - (fail "Expected all structures of opening form to be identifiers."))) + (fail "Expected all implementations of opening form to be identifiers."))) structs) next+remainder (parse_openings parts')] (let [[next remainder] next+remainder] @@ -4234,8 +4234,8 @@ [enhanced_target (monad\fold meta_monad (function (_ [m_local m_type] enhanced_target) (do meta_monad - [m_structure (resolve_type_tags m_type)] - (case m_structure + [m_implementation (resolve_type_tags m_type)] + (case m_implementation (#Some m_tags&members) (recur m_local m_tags&members @@ -4368,7 +4368,7 @@ (macro: #export (open: tokens) {#.doc (text$ ($_ "lux text concat" - "## Opens a structure and generates a definition for each of its members (including nested members)." + "## Opens a implementation and generates a definition for each of its members (including nested members)." __paragraph "## For example:" ..\n "(open: ''i:.'' number)" @@ -4587,7 +4587,7 @@ (macro: #export (\ tokens) {#.doc (text$ ($_ "lux text concat" - "## Allows accessing the value of a structure's member." ..\n + "## Allows accessing the value of a implementation's member." ..\n "(\ codec encode)" __paragraph "## Also allows using that value as a function." ..\n @@ -5171,7 +5171,7 @@ {#.doc (doc "Controlled macro-expansion." "Bind an arbitraty number of Code nodes resulting from macro-expansion to local bindings." "Wherever a binding appears, the bound Code nodes will be spliced in there." - (test: "Code operations & structures" + (test: "Code operations & implementations" (with_expansions [<tests> (template [<expr> <text>] [(compare <text> (\ Code/encode encode <expr>))] diff --git a/stdlib/source/lux/abstract/apply.lux b/stdlib/source/lux/abstract/apply.lux index 21d3fb2df..6f0e61ba8 100644 --- a/stdlib/source/lux/abstract/apply.lux +++ b/stdlib/source/lux/abstract/apply.lux @@ -4,7 +4,7 @@ [monad (#+ Monad)] ["." functor (#+ Functor)]]) -(signature: #export (Apply f) +(interface: #export (Apply f) {#.doc "Applicative functors."} (: (Functor f) &functor) @@ -12,7 +12,7 @@ (-> (f (-> a b)) (f a) (f b))) apply)) -(structure: #export (compose f-monad f-apply g-apply) +(implementation: #export (compose f-monad f-apply g-apply) {#.doc "Applicative functor composition."} (All [F G] (-> (Monad F) (Apply F) (Apply G) diff --git a/stdlib/source/lux/abstract/codec.lux b/stdlib/source/lux/abstract/codec.lux index ad59ce450..454b64cb5 100644 --- a/stdlib/source/lux/abstract/codec.lux +++ b/stdlib/source/lux/abstract/codec.lux @@ -6,14 +6,14 @@ [monad (#+ do)] ["." functor]]) -(signature: #export (Codec m a) +(interface: #export (Codec m a) {#.doc "A way to move back-and-forth between a type and an alternative representation for it."} (: (-> a m) encode) (: (-> m (Try a)) decode)) -(structure: #export (compose cb-codec ba-codec) +(implementation: #export (compose cb-codec ba-codec) {#.doc "Codec composition."} (All [a b c] (-> (Codec c b) (Codec b a) diff --git a/stdlib/source/lux/abstract/comonad.lux b/stdlib/source/lux/abstract/comonad.lux index eeccf9351..63565bd3a 100644 --- a/stdlib/source/lux/abstract/comonad.lux +++ b/stdlib/source/lux/abstract/comonad.lux @@ -11,7 +11,7 @@ [// [functor (#+ Functor)]]) -(signature: #export (CoMonad w) +(interface: #export (CoMonad w) {#.doc (doc "CoMonads are the opposite/complement to monads." "CoMonadic structures are often infinite in size and built upon lazily-evaluated functions.")} (: (Functor w) diff --git a/stdlib/source/lux/abstract/comonad/cofree.lux b/stdlib/source/lux/abstract/comonad/cofree.lux index 8e43cd9bf..64413f1ce 100644 --- a/stdlib/source/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/lux/abstract/comonad/cofree.lux @@ -8,13 +8,13 @@ {#.doc "The CoFree CoMonad."} [a (F (CoFree F a))]) -(structure: #export (functor dsl) +(implementation: #export (functor dsl) (All [F] (-> (Functor F) (Functor (CoFree F)))) (def: (map f [head tail]) [(f head) (\ dsl map (map f) tail)])) -(structure: #export (comonad dsl) +(implementation: #export (comonad dsl) (All [F] (-> (Functor F) (CoMonad (CoFree F)))) (def: &functor (..functor dsl)) diff --git a/stdlib/source/lux/abstract/enum.lux b/stdlib/source/lux/abstract/enum.lux index 0c099feb2..d98848f78 100644 --- a/stdlib/source/lux/abstract/enum.lux +++ b/stdlib/source/lux/abstract/enum.lux @@ -3,7 +3,7 @@ [// ["." order (#+ Order)]]) -(signature: #export (Enum e) +(interface: #export (Enum e) {#.doc "Enumerable types, with a notion of moving forward and backwards through a type's instances."} (: (Order e) &order) (: (-> e e) succ) diff --git a/stdlib/source/lux/abstract/equivalence.lux b/stdlib/source/lux/abstract/equivalence.lux index 3948d12bd..58d644c9b 100644 --- a/stdlib/source/lux/abstract/equivalence.lux +++ b/stdlib/source/lux/abstract/equivalence.lux @@ -4,21 +4,21 @@ [functor ["." contravariant]]]) -(signature: #export (Equivalence a) +(interface: #export (Equivalence a) {#.doc "Equivalence for a type's instances."} (: (-> a a Bit) =)) (def: #export (rec sub) (All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) - (structure + (implementation (def: (= left right) (sub = left right)))) -(structure: #export functor +(implementation: #export functor (contravariant.Functor Equivalence) (def: (map f equivalence) - (structure + (implementation (def: (= reference sample) (\ equivalence = (f reference) (f sample)))))) diff --git a/stdlib/source/lux/abstract/fold.lux b/stdlib/source/lux/abstract/fold.lux index fd309b5f0..3f957bb55 100644 --- a/stdlib/source/lux/abstract/fold.lux +++ b/stdlib/source/lux/abstract/fold.lux @@ -3,7 +3,7 @@ [// [monoid (#+ Monoid)]]) -(signature: #export (Fold F) +(interface: #export (Fold F) {#.doc "Iterate over a structure's values to build a summary value."} (: (All [a b] (-> (-> b a a) a (F b) a)) diff --git a/stdlib/source/lux/abstract/functor.lux b/stdlib/source/lux/abstract/functor.lux index 03c10eaaf..d3012b686 100644 --- a/stdlib/source/lux/abstract/functor.lux +++ b/stdlib/source/lux/abstract/functor.lux @@ -1,6 +1,6 @@ (.module: lux) -(signature: #export (Functor f) +(interface: #export (Functor f) (: (All [a b] (-> (-> a b) (-> (f a) (f b)))) @@ -14,7 +14,7 @@ (def: #export (sum (^open "f\.") (^open "g\.")) (All [F G] (-> (Functor F) (Functor G) (Functor (..Or F G)))) - (structure + (implementation (def: (map f fa|ga) (case fa|ga (#.Left fa) @@ -28,7 +28,7 @@ (def: #export (product (^open "f\.") (^open "g\.")) (All [F G] (-> (Functor F) (Functor G) (Functor (..And F G)))) - (structure + (implementation (def: (map f [fa ga]) [(f\map f fa) (g\map f ga)]))) @@ -39,6 +39,6 @@ (def: #export (compose (^open "f\.") (^open "g\.")) {#.doc "Functor composition."} (All [F G] (-> (Functor F) (Functor G) (Functor (..Then F G)))) - (structure + (implementation (def: (map f fga) (f\map (g\map f) fga)))) diff --git a/stdlib/source/lux/abstract/functor/contravariant.lux b/stdlib/source/lux/abstract/functor/contravariant.lux index 79ae218fa..d91813e1f 100644 --- a/stdlib/source/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/lux/abstract/functor/contravariant.lux @@ -1,7 +1,7 @@ (.module: [lux #*]) -(signature: #export (Functor f) +(interface: #export (Functor f) (: (All [a b] (-> (-> b a) (-> (f a) (f b)))) diff --git a/stdlib/source/lux/abstract/hash.lux b/stdlib/source/lux/abstract/hash.lux index 9a8b44dfb..14857ef18 100644 --- a/stdlib/source/lux/abstract/hash.lux +++ b/stdlib/source/lux/abstract/hash.lux @@ -5,7 +5,7 @@ [functor ["." contravariant]]]) -(signature: #export (Hash a) +(interface: #export (Hash a) {#.doc (doc "A way to produce hash-codes for a type's instances." "A necessity when working with some data-structures, such as dictionaries or sets.")} (: (Equivalence a) @@ -13,11 +13,11 @@ (: (-> a Nat) hash)) -(structure: #export functor +(implementation: #export functor (contravariant.Functor Hash) (def: (map f super) - (structure + (implementation (def: &equivalence (\ equivalence.functor map f (\ super &equivalence))) diff --git a/stdlib/source/lux/abstract/interval.lux b/stdlib/source/lux/abstract/interval.lux index fbe3a4c8a..e43529890 100644 --- a/stdlib/source/lux/abstract/interval.lux +++ b/stdlib/source/lux/abstract/interval.lux @@ -6,7 +6,7 @@ ["." order] [enum (#+ Enum)]]) -(signature: #export (Interval a) +(interface: #export (Interval a) {#.doc "A representation of top and bottom boundaries for an ordered type."} (: (Enum a) &enum) @@ -19,14 +19,14 @@ (def: #export (between enum bottom top) (All [a] (-> (Enum a) a a (Interval a))) - (structure + (implementation (def: &enum enum) (def: bottom bottom) (def: top top))) (def: #export (singleton enum elem) (All [a] (-> (Enum a) a (Interval a))) - (structure + (implementation (def: &enum enum) (def: bottom elem) (def: top elem))) @@ -74,22 +74,25 @@ (def: #export (union left right) (All [a] (-> (Interval a) (Interval a) (Interval a))) - (structure (def: &enum (get@ #&enum right)) - (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) - (def: top (order.max (\ right &order) (\ left top) (\ right top))))) + (implementation + (def: &enum (get@ #&enum right)) + (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) + (def: top (order.max (\ right &order) (\ left top) (\ right top))))) (def: #export (intersection left right) (All [a] (-> (Interval a) (Interval a) (Interval a))) - (structure (def: &enum (get@ #&enum right)) - (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) - (def: top (order.min (\ right &order) (\ left top) (\ right top))))) + (implementation + (def: &enum (get@ #&enum right)) + (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) + (def: top (order.min (\ right &order) (\ left top) (\ right top))))) (def: #export (complement interval) (All [a] (-> (Interval a) (Interval a))) (let [(^open ".") interval] - (structure (def: &enum (get@ #&enum interval)) - (def: bottom (succ top)) - (def: top (pred bottom))))) + (implementation + (def: &enum (get@ #&enum interval)) + (def: bottom (succ top)) + (def: top (pred bottom))))) (def: #export (precedes? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) @@ -139,7 +142,7 @@ [finishes? ,\top order.>= ,\bottom] ) -(structure: #export equivalence (All [a] (Equivalence (Interval a))) +(implementation: #export equivalence (All [a] (Equivalence (Interval a))) (def: (= reference sample) (let [(^open ",\.") reference] (and (,\= ,\bottom (\ sample bottom)) diff --git a/stdlib/source/lux/abstract/monad.lux b/stdlib/source/lux/abstract/monad.lux index 900d5cca4..d32bdacbb 100644 --- a/stdlib/source/lux/abstract/monad.lux +++ b/stdlib/source/lux/abstract/monad.lux @@ -42,7 +42,7 @@ _ #.Nil)) -(signature: #export (Monad m) +(interface: #export (Monad m) (: (Functor m) &functor) (: (All [a] diff --git a/stdlib/source/lux/abstract/monad/free.lux b/stdlib/source/lux/abstract/monad/free.lux index 3eb01064d..7a9efbeea 100644 --- a/stdlib/source/lux/abstract/monad/free.lux +++ b/stdlib/source/lux/abstract/monad/free.lux @@ -10,7 +10,7 @@ (#Pure a) (#Effect (F (Free F a)))) -(structure: #export (functor dsl) +(implementation: #export (functor dsl) (All [F] (-> (Functor F) (Functor (Free F)))) (def: (map f ea) @@ -21,7 +21,7 @@ (#Effect value) (#Effect (\ dsl map (map f) value))))) -(structure: #export (apply dsl) +(implementation: #export (apply dsl) (All [F] (-> (Functor F) (Apply (Free F)))) (def: &functor (..functor dsl)) @@ -42,7 +42,7 @@ ff)) ))) -(structure: #export (monad dsl) +(implementation: #export (monad dsl) (All [F] (-> (Functor F) (Monad (Free F)))) (def: &functor (..functor dsl)) diff --git a/stdlib/source/lux/abstract/monad/indexed.lux b/stdlib/source/lux/abstract/monad/indexed.lux index b6c603d0c..5a5a63b27 100644 --- a/stdlib/source/lux/abstract/monad/indexed.lux +++ b/stdlib/source/lux/abstract/monad/indexed.lux @@ -11,7 +11,7 @@ [syntax (#+ syntax:)] ["." code]]]) -(signature: #export (IxMonad m) +(interface: #export (IxMonad m) (: (All [p a] (-> a (m p p a))) wrap) diff --git a/stdlib/source/lux/abstract/monoid.lux b/stdlib/source/lux/abstract/monoid.lux index c87cf8b40..2b5560421 100644 --- a/stdlib/source/lux/abstract/monoid.lux +++ b/stdlib/source/lux/abstract/monoid.lux @@ -1,7 +1,7 @@ (.module: [lux #*]) -(signature: #export (Monoid a) +(interface: #export (Monoid a) {#.doc (doc "A way to compose values." "Includes an identity value which does not alter any other value when combined with.")} (: a @@ -11,7 +11,7 @@ (def: #export (compose left right) (All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r]))) - (structure + (implementation (def: identity [(\ left identity) (\ right identity)]) diff --git a/stdlib/source/lux/abstract/order.lux b/stdlib/source/lux/abstract/order.lux index 21f5739d2..9d031bca2 100644 --- a/stdlib/source/lux/abstract/order.lux +++ b/stdlib/source/lux/abstract/order.lux @@ -7,7 +7,7 @@ [functor ["." contravariant]]]) -(signature: #export (Order a) +(interface: #export (Order a) {#.doc "A signature for types that possess some sense of ordering among their elements."} (: (Equivalence a) @@ -45,11 +45,11 @@ Choice (if (\ order < y x) y x)) -(structure: #export functor +(implementation: #export functor (contravariant.Functor Order) (def: (map f order) - (structure + (implementation (def: &equivalence (\ equivalence.functor map f (\ order &equivalence))) diff --git a/stdlib/source/lux/abstract/predicate.lux b/stdlib/source/lux/abstract/predicate.lux index 13aa9a083..03b071fa4 100644 --- a/stdlib/source/lux/abstract/predicate.lux +++ b/stdlib/source/lux/abstract/predicate.lux @@ -26,7 +26,7 @@ ) (template [<name> <identity> <composition>] - [(structure: #export <name> + [(implementation: #export <name> (All [a] (Monoid (Predicate a))) (def: identity <identity>) @@ -53,7 +53,7 @@ (function (recur input) (predicate recur input))) -(structure: #export functor +(implementation: #export functor (contravariant.Functor Predicate) (def: (map f fb) diff --git a/stdlib/source/lux/control/concurrency/frp.lux b/stdlib/source/lux/control/concurrency/frp.lux index 868bc4153..452c153f1 100644 --- a/stdlib/source/lux/control/concurrency/frp.lux +++ b/stdlib/source/lux/control/concurrency/frp.lux @@ -24,7 +24,7 @@ (exception: #export channel_is_already_closed) -(signature: #export (Sink a) +(interface: #export (Sink a) (: (IO (Try Any)) close) (: (-> a (IO (Try Any))) @@ -35,7 +35,7 @@ (-> (promise.Resolver (Maybe [a (Channel a)])) (Sink a))) (let [sink (atom.atom resolve)] - (structure + (implementation (def: close (loop [_ []] (do {! io.monad} @@ -84,7 +84,7 @@ (let [[promise resolve] (promise.promise [])] [promise (..sink resolve)])) -(structure: #export functor +(implementation: #export functor (Functor Channel) (def: (map f) @@ -93,7 +93,7 @@ (function (_ [head tail]) [(f head) (map f tail)]))))) -(structure: #export apply +(implementation: #export apply (Apply Channel) (def: &functor ..functor) @@ -113,7 +113,7 @@ Channel (promise.resolved #.None)) -(structure: #export monad +(implementation: #export monad (Monad Channel) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/concurrency/promise.lux b/stdlib/source/lux/control/concurrency/promise.lux index acba089fd..8e0acf8b9 100644 --- a/stdlib/source/lux/control/concurrency/promise.lux +++ b/stdlib/source/lux/control/concurrency/promise.lux @@ -91,7 +91,7 @@ (#.Some _) #1))))) -(structure: #export functor +(implementation: #export functor (Functor Promise) (def: (map f fa) @@ -99,7 +99,7 @@ (exec (io.run (..await (|>> f resolve) fa)) fb)))) -(structure: #export apply +(implementation: #export apply (Apply Promise) (def: &functor ..functor) @@ -111,7 +111,7 @@ ff)) fb)))) -(structure: #export monad +(implementation: #export monad (Monad Promise) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/concurrency/stm.lux b/stdlib/source/lux/control/concurrency/stm.lux index 7fd916fdb..e43ecb98e 100644 --- a/stdlib/source/lux/control/concurrency/stm.lux +++ b/stdlib/source/lux/control/concurrency/stm.lux @@ -142,7 +142,7 @@ [(#.Cons [var (..read! var) value] tx) []]))) -(structure: #export functor +(implementation: #export functor (Functor STM) (def: (map f fa) @@ -150,7 +150,7 @@ (let [[tx' a] (fa tx)] [tx' (f a)])))) -(structure: #export apply +(implementation: #export apply (Apply STM) (def: &functor ..functor) @@ -161,7 +161,7 @@ [tx'' a] (fa tx')] [tx'' (f a)])))) -(structure: #export monad +(implementation: #export monad (Monad STM) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/continuation.lux b/stdlib/source/lux/control/continuation.lux index 8aef0d9b1..03a9607ce 100644 --- a/stdlib/source/lux/control/continuation.lux +++ b/stdlib/source/lux/control/continuation.lux @@ -56,13 +56,13 @@ (f (function (_ a) (function (_ ic) (ic (oc a)))) function.identity))) -(structure: #export functor +(implementation: #export functor (All [o] (Functor (All [i] (Cont i o)))) (def: (map f fv) (function (_ k) (fv (function.compose k f))))) -(structure: #export apply +(implementation: #export apply (All [o] (Apply (All [i] (Cont i o)))) (def: &functor ..functor) @@ -73,7 +73,7 @@ (function (_ v)) fv (function (_ f)) ff)))) -(structure: #export monad +(implementation: #export monad (All [o] (Monad (All [i] (Cont i o)))) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/function.lux b/stdlib/source/lux/control/function.lux index 855f585c9..56e54509c 100644 --- a/stdlib/source/lux/control/function.lux +++ b/stdlib/source/lux/control/function.lux @@ -39,7 +39,7 @@ (-> i (-> i o) o)) (function input)) -(structure: #export monoid +(implementation: #export monoid (All [a] (Monoid (-> a a))) (def: identity ..identity) diff --git a/stdlib/source/lux/control/function/mixin.lux b/stdlib/source/lux/control/function/mixin.lux index f10123aa6..4d1c9fcb8 100644 --- a/stdlib/source/lux/control/function/mixin.lux +++ b/stdlib/source/lux/control/function/mixin.lux @@ -26,7 +26,7 @@ (function (_ delegate recur) (parent (child delegate recur) recur))) -(structure: #export monoid +(implementation: #export monoid (All [i o] (Monoid (Mixin i o))) (def: identity ..nothing) diff --git a/stdlib/source/lux/control/io.lux b/stdlib/source/lux/control/io.lux index 2b5946322..fea9083ec 100644 --- a/stdlib/source/lux/control/io.lux +++ b/stdlib/source/lux/control/io.lux @@ -46,13 +46,13 @@ (All [a] (-> (IO a) a)) (|>> !run)) - (structure: #export functor + (implementation: #export functor (Functor IO) (def: (map f) (|>> !run f !io))) - (structure: #export apply + (implementation: #export apply (Apply IO) (def: &functor ..functor) @@ -60,7 +60,7 @@ (def: (apply ff fa) (!io ((!run ff) (!run fa))))) - (structure: #export monad + (implementation: #export monad (Monad IO) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 8ee53fcb8..d22627fb5 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -19,7 +19,7 @@ {#.doc "A generic parser."} (-> s (Try [s a]))) -(structure: #export functor +(implementation: #export functor (All [s] (Functor (Parser s))) (def: (map f ma) @@ -31,7 +31,7 @@ (#try.Success [input' a]) (#try.Success [input' (f a)]))))) -(structure: #export apply +(implementation: #export apply (All [s] (Apply (Parser s))) (def: &functor ..functor) @@ -50,7 +50,7 @@ (#try.Failure msg) (#try.Failure msg))))) -(structure: #export monad +(implementation: #export monad (All [s] (Monad (Parser s))) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/reader.lux b/stdlib/source/lux/control/reader.lux index fc1755990..615bdfe80 100644 --- a/stdlib/source/lux/control/reader.lux +++ b/stdlib/source/lux/control/reader.lux @@ -23,14 +23,14 @@ (All [r a] (-> r (Reader r a) a)) (proc env)) -(structure: #export functor +(implementation: #export functor (All [r] (Functor (Reader r))) (def: (map f fa) (function (_ env) (f (fa env))))) -(structure: #export apply +(implementation: #export apply (All [r] (Apply (Reader r))) (def: &functor ..functor) @@ -39,7 +39,7 @@ (function (_ env) ((ff env) (fa env))))) -(structure: #export monad +(implementation: #export monad (All [r] (Monad (Reader r))) (def: &functor ..functor) @@ -51,7 +51,7 @@ (function (_ env) (mma env env)))) -(structure: #export (with monad) +(implementation: #export (with monad) {#.doc "Monad transformer for Reader."} (All [M] (-> (Monad M) (All [e] (Monad (All [a] (Reader e (M a))))))) diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux index f707a748e..5b2a6fef1 100644 --- a/stdlib/source/lux/control/region.lux +++ b/stdlib/source/lux/control/region.lux @@ -68,7 +68,7 @@ cleaners) (#try.Success value)]))) -(structure: #export (functor super) +(implementation: #export (functor super) (All [!] (-> (Functor !) (All [r] (Functor (Region r !))))) @@ -86,7 +86,7 @@ (#try.Failure error))]) (fa region+cleaners)))))) -(structure: #export (apply super) +(implementation: #export (apply super) (All [!] (-> (Monad !) (All [r] (Apply (Region r !))))) @@ -111,7 +111,7 @@ (#try.Failure error) (wrap [cleaners (#try.Failure error)])))))) -(structure: #export (monad super) +(implementation: #export (monad super) (All [!] (-> (Monad !) (All [r] (Monad (Region r !))))) diff --git a/stdlib/source/lux/control/security/policy.lux b/stdlib/source/lux/control/security/policy.lux index 56b8d6b11..25afafd5e 100644 --- a/stdlib/source/lux/control/security/policy.lux +++ b/stdlib/source/lux/control/security/policy.lux @@ -59,20 +59,20 @@ (-> Type Type) (type (All [brand label] (constructor (All [value] (Policy brand value label)))))) - (structure: #export functor + (implementation: #export functor (:~ (decorate Functor)) (def: (map f fa) (|> fa :representation f :abstraction))) - (structure: #export apply + (implementation: #export apply (:~ (decorate Apply)) (def: &functor ..functor) (def: (apply ff fa) (:abstraction ((:representation ff) (:representation fa))))) - (structure: #export monad + (implementation: #export monad (:~ (decorate Monad)) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/state.lux b/stdlib/source/lux/control/state.lux index 2441efa8e..0914f5dde 100644 --- a/stdlib/source/lux/control/state.lux +++ b/stdlib/source/lux/control/state.lux @@ -45,7 +45,7 @@ (All [s a] (-> s (State s a) [s a])) (action state)) -(structure: #export functor +(implementation: #export functor (All [s] (Functor (State s))) (def: (map f ma) @@ -53,7 +53,7 @@ (let [[state' a] (ma state)] [state' (f a)])))) -(structure: #export apply +(implementation: #export apply (All [s] (Apply (State s))) (def: &functor ..functor) @@ -64,7 +64,7 @@ [state'' a] (fa state')] [state'' (f a)])))) -(structure: #export monad +(implementation: #export monad (All [s] (Monad (State s))) (def: &functor ..functor) @@ -94,7 +94,7 @@ [_ body] (while condition body))) -(structure: (with//functor functor) +(implementation: (with//functor functor) (All [M s] (-> (Functor M) (Functor (All [a] (-> s (M [s a])))))) (def: (map f sfa) @@ -102,7 +102,7 @@ (\ functor map (function (_ [s a]) [s (f a)]) (sfa state))))) -(structure: (with//apply monad) +(implementation: (with//apply monad) (All [M s] (-> (Monad M) (Apply (All [a] (-> s (M [s a])))))) (def: &functor (with//functor (\ monad &functor))) @@ -123,7 +123,7 @@ (All [M s a] (-> s (State' M s a) (M [s a]))) (action state)) -(structure: #export (with monad) +(implementation: #export (with monad) {#.doc "A monad transformer to create composite stateful computations."} (All [M s] (-> (Monad M) (Monad (State' M s)))) diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux index 74d5940bc..39acb2192 100644 --- a/stdlib/source/lux/control/thread.lux +++ b/stdlib/source/lux/control/thread.lux @@ -67,7 +67,7 @@ (IO a))) (|>> ..run io.io)) -(structure: #export functor +(implementation: #export functor (All [!] (Functor (Thread !))) (def: (map f) @@ -75,7 +75,7 @@ (function (_ !) (f (fa !)))))) -(structure: #export apply +(implementation: #export apply (All [!] (Apply (Thread !))) (def: &functor ..functor) @@ -84,7 +84,7 @@ (function (_ !) ((ff !) (fa !))))) -(structure: #export monad +(implementation: #export monad (All [!] (Monad (Thread !))) (def: &functor ..functor) diff --git a/stdlib/source/lux/control/try.lux b/stdlib/source/lux/control/try.lux index 3cc00bf0a..e60068cb1 100644 --- a/stdlib/source/lux/control/try.lux +++ b/stdlib/source/lux/control/try.lux @@ -12,7 +12,7 @@ (#Failure Text) (#Success a)) -(structure: #export functor +(implementation: #export functor (Functor Try) (def: (map f ma) @@ -23,7 +23,7 @@ (#Success datum) (#Success (f datum))))) -(structure: #export apply +(implementation: #export apply (Apply Try) (def: &functor ..functor) @@ -42,7 +42,7 @@ (#Failure msg)) )) -(structure: #export monad +(implementation: #export monad (Monad Try) (def: &functor ..functor) @@ -58,7 +58,7 @@ (#Success ma) ma))) -(structure: #export (with monad) +(implementation: #export (with monad) ## TODO: Replace (All [a] (M (Try a))) with (functor.Then M Try) (All [M] (-> (Monad M) (Monad (All [a] (M (Try a)))))) @@ -80,7 +80,7 @@ (All [M a] (-> (Monad M) (-> (M a) (M (Try a))))) (\ monad map (\ ..monad wrap))) -(structure: #export (equivalence (^open "_\.")) +(implementation: #export (equivalence (^open "_\.")) (All [a] (-> (Equivalence a) (Equivalence (Try a)))) (def: (= reference sample) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index 9c4b2850a..92ab8f751 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -17,7 +17,7 @@ (All [l] (-> l (Writer l Any))) [l []]) -(structure: #export functor +(implementation: #export functor (All [l] (Functor (Writer l))) @@ -25,7 +25,7 @@ (let [[log datum] fa] [log (f datum)]))) -(structure: #export (apply monoid) +(implementation: #export (apply monoid) (All [l] (-> (Monoid l) (Apply (Writer l)))) @@ -36,7 +36,7 @@ [log2 a] fa] [(\ monoid compose log1 log2) (f a)]))) -(structure: #export (monad monoid) +(implementation: #export (monad monoid) (All [l] (-> (Monoid l) (Monad (Writer l)))) @@ -49,7 +49,7 @@ (let [[log1 [log2 a]] mma] [(\ monoid compose log1 log2) a]))) -(structure: #export (with monoid monad) +(implementation: #export (with monoid monad) (All [l M] (-> (Monoid l) (Monad M) (Monad (All [a] (M (Writer l a)))))) (def: &functor diff --git a/stdlib/source/lux/data/binary.lux b/stdlib/source/lux/data/binary.lux index 9dfc6f96b..7e32772b7 100644 --- a/stdlib/source/lux/data/binary.lux +++ b/stdlib/source/lux/data/binary.lux @@ -275,7 +275,7 @@ (!write (n.+ 7 idx) value)))) (exception.throw ..index_out_of_bounds [(..!size binary) idx]))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Binary) (def: (= reference sample) @@ -350,7 +350,7 @@ (#try.Failure _) (..create 0))))) -(structure: #export monoid +(implementation: #export monoid (Monoid Binary) (def: identity diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index fee6eba92..88c9b4bd7 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -8,7 +8,7 @@ [control ["." function]]]) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Bit) (def: (= x y) @@ -16,7 +16,7 @@ y (not y)))) -(structure: #export hash +(implementation: #export hash (Hash Bit) (def: &equivalence ..equivalence) @@ -27,7 +27,7 @@ #1 3))) (template [<name> <identity> <op>] - [(structure: #export <name> + [(implementation: #export <name> (Monoid Bit) (def: identity <identity>) @@ -37,7 +37,7 @@ [conjunction #1 and] ) -(structure: #export codec +(implementation: #export codec (Codec Text Bit) (def: (encode x) diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 9e8f850f8..bb19af564 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -298,7 +298,7 @@ (#.Cons (maybe.default default (read idx array)) output))))) -(structure: #export (equivalence (^open ",\.")) +(implementation: #export (equivalence (^open ",\.")) (All [a] (-> (Equivalence a) (Equivalence (Array a)))) (def: (= xs ys) @@ -319,7 +319,7 @@ true (list.indices sxs)))))) -(structure: #export monoid +(implementation: #export monoid (All [a] (Monoid (Array a))) (def: identity (new 0)) @@ -331,7 +331,7 @@ (copy! sxs 0 xs 0) (copy! sxy 0 ys sxs))))) -(structure: #export functor +(implementation: #export functor (Functor Array) (def: (map f ma) @@ -349,7 +349,7 @@ (list.indices arr_size)) )))) -(structure: #export fold +(implementation: #export fold (Fold Array) (def: (fold f init xs) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index a50ec0903..78d7df988 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -161,7 +161,7 @@ [xor i64.xor] ) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Bits) (def: (= reference sample) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 732c5ff85..4aa50c9a7 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -686,7 +686,7 @@ (new Hash<k>) keys))) -(structure: #export (equivalence (^open ",\.")) +(implementation: #export (equivalence (^open ",\.")) (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) (def: (= reference subject) @@ -701,7 +701,7 @@ #0)) (..entries reference))))) -(structure: functor' +(implementation: functor' (All [k] (Functor (Node k))) (def: (map f fa) @@ -724,7 +724,7 @@ [k (f v)]) collisions))))) -(structure: #export functor +(implementation: #export functor (All [k] (Functor (Dictionary k))) (def: (map f fa) diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index 5b2039a47..618c5ccf6 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -563,7 +563,7 @@ [values v (get@ #value node')] ) -(structure: #export (equivalence (^open ",\.")) +(implementation: #export (equivalence (^open ",\.")) (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) (def: (= reference sample) diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 432e98abd..7bb2d4468 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -22,7 +22,7 @@ ## #Nil ## (#Cons a (List a))) -(structure: #export fold +(implementation: #export fold (Fold List) (def: (fold f init xs) @@ -294,7 +294,7 @@ (#.Some x) (nth (dec i) xs')))) -(structure: #export (equivalence Equivalence<a>) +(implementation: #export (equivalence Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (List a)))) (def: (= xs ys) @@ -310,7 +310,7 @@ #0 ))) -(structure: #export (hash super) +(implementation: #export (hash super) (All [a] (-> (Hash a) (Hash (List a)))) (def: &equivalence @@ -322,7 +322,7 @@ (n.+ (\ super hash member) hash)) 0))) -(structure: #export monoid +(implementation: #export monoid (All [a] (Monoid (List a))) (def: identity #.Nil) @@ -336,7 +336,7 @@ (open: "." ..monoid) -(structure: #export functor +(implementation: #export functor (Functor List) (def: (map f ma) @@ -349,7 +349,7 @@ (open: "." ..functor) -(structure: #export apply +(implementation: #export apply (Apply List) (def: &functor ..functor) @@ -362,7 +362,7 @@ (#.Cons f ff') (compose (map f fa) (apply ff' fa))))) -(structure: #export monad +(implementation: #export monad (Monad List) (def: &functor ..functor) @@ -581,7 +581,7 @@ (All [a] (-> (List (List a)) (List a))) (\ ..monad join xss)) -(structure: #export (with monad) +(implementation: #export (with monad) (All [M] (-> (Monad M) (Monad (All [a] (M (List a)))))) (def: &functor (functor.compose (get@ #monad.&functor monad) ..functor)) diff --git a/stdlib/source/lux/data/collection/queue.lux b/stdlib/source/lux/data/collection/queue.lux index e351a4956..32ed05c64 100644 --- a/stdlib/source/lux/data/collection/queue.lux +++ b/stdlib/source/lux/data/collection/queue.lux @@ -76,7 +76,7 @@ _ (update@ #rear (|>> (#.Cons val)) queue))) -(structure: #export (equivalence super) +(implementation: #export (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Queue a)))) (def: (= reference subject) @@ -84,7 +84,7 @@ (..to_list reference) (..to_list subject)))) -(structure: #export functor +(implementation: #export functor (Functor Queue) (def: (map f fa) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index dd1cbcc42..abadcfd7a 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -360,7 +360,7 @@ (row +10 +20 +30 +40))} (wrap (list (` (..from_list (list (~+ elems))))))) -(structure: (node_equivalence Equivalence<a>) +(implementation: (node_equivalence Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Node a)))) (def: (= v1 v2) @@ -374,7 +374,7 @@ _ #0))) -(structure: #export (equivalence Equivalence<a>) +(implementation: #export (equivalence Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Row a)))) (def: (= v1 v2) @@ -385,7 +385,7 @@ (node\= (#Hierarchy (get@ #root v1)) (#Hierarchy (get@ #root v2)))))))) -(structure: node_fold +(implementation: node_fold (Fold Node) (def: (fold f init xs) @@ -398,7 +398,7 @@ init hierarchy)))) -(structure: #export fold +(implementation: #export fold (Fold Row) (def: (fold f init xs) @@ -409,7 +409,7 @@ (#Hierarchy (get@ #root xs))) (#Base (get@ #tail xs)))))) -(structure: #export monoid +(implementation: #export monoid (All [a] (Monoid (Row a))) (def: identity ..empty) @@ -417,7 +417,7 @@ (def: (compose xs ys) (list\fold add xs (..to_list ys)))) -(structure: node_functor +(implementation: node_functor (Functor Node) (def: (map f xs) @@ -428,7 +428,7 @@ (#Hierarchy hierarchy) (#Hierarchy (array\map (map f) hierarchy))))) -(structure: #export functor +(implementation: #export functor (Functor Row) (def: (map f xs) @@ -437,7 +437,7 @@ #root (|> xs (get@ #root) (array\map (\ node_functor map f))) #tail (|> xs (get@ #tail) (array\map f))})) -(structure: #export apply +(implementation: #export apply (Apply Row) (def: &functor ..functor) @@ -450,7 +450,7 @@ ff)] (fold compose identity results)))) -(structure: #export monad +(implementation: #export monad (Monad Row) (def: &functor ..functor) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index 118b75a61..c3d2a5e33 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -116,14 +116,14 @@ (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) [(filter left? xs) (filter (bit.complement left?) xs)]) -(structure: #export functor +(implementation: #export functor (Functor Sequence) (def: (map f fa) (let [[head tail] (//.run fa)] (//.pending [(f head) (map f tail)])))) -(structure: #export comonad +(implementation: #export comonad (CoMonad Sequence) (def: &functor ..functor) diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux index ca95a7a4b..4c1fabde0 100644 --- a/stdlib/source/lux/data/collection/set.lux +++ b/stdlib/source/lux/data/collection/set.lux @@ -58,7 +58,7 @@ (//.select (//.keys filter) base)) -(structure: #export equivalence +(implementation: #export equivalence (All [a] (Equivalence (Set a))) (def: (= (^@ reference [hash _]) sample) @@ -67,7 +67,7 @@ (list.every? (..member? reference) (..to_list sample))))) -(structure: #export hash +(implementation: #export hash (All [a] (Hash (Set a))) (def: &equivalence ..equivalence) @@ -77,7 +77,7 @@ ..to_list (\ (list.hash (..member_hash set)) hash)))) -(structure: #export (monoid hash) +(implementation: #export (monoid hash) (All [a] (-> (Hash a) (Monoid (Set a)))) (def: identity (..new hash)) diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux index 6fd3a4671..9e494608e 100644 --- a/stdlib/source/lux/data/collection/set/multi.lux +++ b/stdlib/source/lux/data/collection/set/multi.lux @@ -109,7 +109,7 @@ dictionary.keys (//.from_list hash)))) - (structure: #export equivalence + (implementation: #export equivalence (All [a] (Equivalence (Set a))) (def: (= (^:representation reference) sample) @@ -122,7 +122,7 @@ (..multiplicity sample) (n.= multiplicity)))))))) - (structure: #export hash + (implementation: #export hash (All [a] (Hash (Set a))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/data/collection/set/ordered.lux b/stdlib/source/lux/data/collection/set/ordered.lux index 71183d2e4..1b57ac87d 100644 --- a/stdlib/source/lux/data/collection/set/ordered.lux +++ b/stdlib/source/lux/data/collection/set/ordered.lux @@ -65,7 +65,7 @@ (list.filter (|>> (..member? param) not)) (..from_list (get@ #/.&order (:representation subject))))) - (structure: #export equivalence + (implementation: #export equivalence (All [a] (Equivalence (Set a))) (def: (= reference sample) diff --git a/stdlib/source/lux/data/collection/stack.lux b/stdlib/source/lux/data/collection/stack.lux index 398fa71ba..68d514331 100644 --- a/stdlib/source/lux/data/collection/stack.lux +++ b/stdlib/source/lux/data/collection/stack.lux @@ -46,7 +46,7 @@ (All [a] (-> a (Stack a) (Stack a))) (:abstraction (#.Cons value (:representation stack)))) - (structure: #export (equivalence super) + (implementation: #export (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Stack a)))) @@ -54,7 +54,7 @@ (def: (= reference subject) (\ (//.equivalence super) = (:representation reference) (:representation subject)))) - (structure: #export functor + (implementation: #export functor (Functor Stack) (def: (map f value) diff --git a/stdlib/source/lux/data/collection/tree.lux b/stdlib/source/lux/data/collection/tree.lux index b690e7128..5aa6f9c36 100644 --- a/stdlib/source/lux/data/collection/tree.lux +++ b/stdlib/source/lux/data/collection/tree.lux @@ -59,14 +59,14 @@ (` {#value (~ value) #children (list (~+ (list\map recur children)))}))))))) -(structure: #export (equivalence super) +(implementation: #export (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Tree a)))) (def: (= tx ty) (and (\ super = (get@ #value tx) (get@ #value ty)) (\ (list.equivalence (equivalence super)) = (get@ #children tx) (get@ #children ty))))) -(structure: #export functor +(implementation: #export functor (Functor Tree) (def: (map f fa) @@ -74,7 +74,7 @@ #children (list\map (map f) (get@ #children fa))})) -(structure: #export fold +(implementation: #export fold (Fold Tree) (def: (fold f init tree) diff --git a/stdlib/source/lux/data/collection/tree/finger.lux b/stdlib/source/lux/data/collection/tree/finger.lux index ae30c294a..d28e69a3c 100644 --- a/stdlib/source/lux/data/collection/tree/finger.lux +++ b/stdlib/source/lux/data/collection/tree/finger.lux @@ -15,7 +15,7 @@ #root (| v [(Tree @ t v) (Tree @ t v)])} - (signature: #export (Builder @ t) + (interface: #export (Builder @ t) (: (All [v] (-> t v (Tree @ t v))) leaf) @@ -34,7 +34,7 @@ [root #root (Either v [(Tree @ t v) (Tree @ t v)])] ) - (structure: #export (builder monoid) + (implementation: #export (builder monoid) (All [t] (Ex [@] (-> (Monoid t) (Builder @ t)))) (def: (leaf tag value) diff --git a/stdlib/source/lux/data/collection/tree/zipper.lux b/stdlib/source/lux/data/collection/tree/zipper.lux index 290f5143e..be2f7b4bd 100644 --- a/stdlib/source/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/zipper.lux @@ -25,7 +25,7 @@ {#family (Maybe (Family Zipper a)) #node (Tree a)}) -(structure: #export (equivalence super) +(implementation: #export (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Zipper a)))) @@ -284,7 +284,7 @@ [insert-right #rights] ) -(structure: #export functor +(implementation: #export functor (Functor Zipper) (def: (map f (^slots [#family #node])) @@ -295,7 +295,7 @@ family) #node (//\map f node)})) -(structure: #export comonad +(implementation: #export comonad (CoMonad Zipper) (def: &functor ..functor) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 6e82155b6..921137d9a 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -60,7 +60,7 @@ (-> Color RGB) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Color) (def: (= reference sample) @@ -70,7 +70,7 @@ (n.= gR gS) (n.= bR bS))))) - (structure: #export hash + (implementation: #export hash (Hash Color) (def: &equivalence ..equivalence) @@ -92,7 +92,7 @@ #green ..top #blue ..top})) - (structure: #export addition + (implementation: #export addition (Monoid Color) (def: identity ..black) @@ -115,7 +115,7 @@ #green (complement' green) #blue (complement' blue)}))) - (structure: #export subtraction + (implementation: #export subtraction (Monoid Color) (def: identity ..white) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index 0cf1fbdd0..25b7b69e5 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -46,7 +46,7 @@ (-> Specification Binary) (|> size binary.create [0] mutation product.right)) -(structure: #export monoid +(implementation: #export monoid (Monoid Specification) (def: identity diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index b1bd3d95e..49a06824c 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -163,7 +163,7 @@ [get_object #Object Object "objects"] ) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence JSON) (def: (= x y) @@ -414,7 +414,7 @@ (parse_array parse_json) (parse_object parse_json))))) -(structure: #export codec +(implementation: #export codec (Codec Text JSON) (def: encode ..format) diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index bee2d2983..4409c3ab5 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -271,13 +271,13 @@ text.new_line prefix "</" tag ">"))))) )) -(structure: #export codec +(implementation: #export codec (Codec Text XML) (def: encode ..write) (def: decode ..read)) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence XML) (def: (= reference sample) diff --git a/stdlib/source/lux/data/identity.lux b/stdlib/source/lux/data/identity.lux index ce0476d8a..35b44ec62 100644 --- a/stdlib/source/lux/data/identity.lux +++ b/stdlib/source/lux/data/identity.lux @@ -11,25 +11,25 @@ (type: #export (Identity a) a) -(structure: #export functor +(implementation: #export functor (Functor Identity) (def: map function.identity)) -(structure: #export apply +(implementation: #export apply (Apply Identity) (def: &functor ..functor) (def: (apply ff fa) (ff fa))) -(structure: #export monad +(implementation: #export monad (Monad Identity) (def: &functor ..functor) (def: wrap function.identity) (def: join function.identity)) -(structure: #export comonad +(implementation: #export comonad (CoMonad Identity) (def: &functor ..functor) diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index 85944d022..adc8458e6 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -40,26 +40,26 @@ (with_gensyms [g!_] (wrap (list (` ((~! freeze') (function ((~ g!_) (~ g!_)) (~ expr)))))))) -(structure: #export (equivalence (^open "_\.")) +(implementation: #export (equivalence (^open "_\.")) (All [a] (-> (Equivalence a) (Equivalence (Lazy a)))) (def: (= left right) (_\= (..thaw left) (..thaw right)))) -(structure: #export functor +(implementation: #export functor (Functor Lazy) (def: (map f fa) (freeze (f (thaw fa))))) -(structure: #export apply +(implementation: #export apply (Apply Lazy) (def: &functor ..functor) (def: (apply ff fa) (freeze ((thaw ff) (thaw fa))))) -(structure: #export monad +(implementation: #export monad (Monad Lazy) (def: &functor ..functor) diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index a5a51300f..6376cfebf 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -14,7 +14,7 @@ ## #.None ## (#.Some a)) -(structure: #export monoid +(implementation: #export monoid (All [a] (Monoid (Maybe a))) (def: identity #.None) @@ -27,7 +27,7 @@ (#.Some x) (#.Some x)))) -(structure: #export functor +(implementation: #export functor (Functor Maybe) (def: (map f ma) @@ -35,7 +35,7 @@ #.None #.None (#.Some a) (#.Some (f a))))) -(structure: #export apply +(implementation: #export apply (Apply Maybe) (def: &functor ..functor) @@ -48,7 +48,7 @@ _ #.None))) -(structure: #export monad +(implementation: #export monad (Monad Maybe) (def: &functor ..functor) @@ -64,7 +64,7 @@ (#.Some mx) mx))) -(structure: #export (equivalence super) +(implementation: #export (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (Maybe a)))) (def: (= mx my) @@ -78,7 +78,7 @@ _ #0))) -(structure: #export (hash super) +(implementation: #export (hash super) (All [a] (-> (Hash a) (Hash (Maybe a)))) (def: &equivalence @@ -92,7 +92,7 @@ (#.Some value) (\ super hash value)))) -(structure: #export (with monad) +(implementation: #export (with monad) (All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a)))))) (def: &functor (functor.compose (get@ #monad.&functor monad) ..functor)) diff --git a/stdlib/source/lux/data/name.lux b/stdlib/source/lux/data/name.lux index 697987a16..539b9a99f 100644 --- a/stdlib/source/lux/data/name.lux +++ b/stdlib/source/lux/data/name.lux @@ -29,7 +29,7 @@ (Equivalence Name) (\ ..hash &equivalence)) -(structure: #export order +(implementation: #export order (Order Name) (def: &equivalence ..equivalence) @@ -41,7 +41,7 @@ (def: separator ".") -(structure: #export codec +(implementation: #export codec (Codec Text Name) (def: (encode [module short]) diff --git a/stdlib/source/lux/data/product.lux b/stdlib/source/lux/data/product.lux index 19878a1b4..9a8c37fb2 100644 --- a/stdlib/source/lux/data/product.lux +++ b/stdlib/source/lux/data/product.lux @@ -49,7 +49,7 @@ (function (_ x) [(f x) (g x)])) -(structure: #export (equivalence left right) +(implementation: #export (equivalence left right) (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) (def: (= [rl rr] [sl sr]) @@ -58,7 +58,7 @@ (def: #export (hash left right) (All [l r] (-> (Hash l) (Hash r) (Hash (& l r)))) - (structure + (implementation (def: &equivalence (..equivalence (\ left &equivalence) (\ right &equivalence))) diff --git a/stdlib/source/lux/data/store.lux b/stdlib/source/lux/data/store.lux index 9c2660a32..52842eac9 100644 --- a/stdlib/source/lux/data/store.lux +++ b/stdlib/source/lux/data/store.lux @@ -15,7 +15,7 @@ {#cursor (get@ #cursor wa) #peek (function (_ s) (f (set@ #cursor s wa)))}) -(structure: #export functor +(implementation: #export functor (All [s] (Functor (Store s))) (def: (map f fa) @@ -23,7 +23,7 @@ (f (\ store peek (\ store cursor)))) fa))) -(structure: #export comonad +(implementation: #export comonad (All [s] (CoMonad (Store s))) (def: &functor ..functor) diff --git a/stdlib/source/lux/data/sum.lux b/stdlib/source/lux/data/sum.lux index 1a39d770b..bb0e6d0e7 100644 --- a/stdlib/source/lux/data/sum.lux +++ b/stdlib/source/lux/data/sum.lux @@ -62,7 +62,7 @@ (def: #export (equivalence left right) (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r)))) - (structure + (implementation (def: (= reference sample) (case [reference sample] [(#.Left reference) (#.Left sample)] @@ -76,7 +76,7 @@ (def: #export (hash left right) (All [l r] (-> (Hash l) (Hash r) (Hash (| l r)))) - (structure + (implementation (def: &equivalence (..equivalence (\ left &equivalence) (\ right &equivalence))) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 4ad4d532c..766d7b928 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -210,13 +210,13 @@ #.None ("lux text concat" left right))))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Text) (def: (= reference sample) ("lux text =" reference sample))) -(structure: #export order +(implementation: #export order (Order Text) (def: &equivalence ..equivalence) @@ -224,7 +224,7 @@ (def: (< reference sample) ("lux text <" reference sample))) -(structure: #export monoid +(implementation: #export monoid (Monoid Text) (def: identity "") @@ -232,7 +232,7 @@ (def: (compose left right) ("lux text concat" left right))) -(structure: #export hash +(implementation: #export hash (Hash Text) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/data/text/encoding/utf8.lux b/stdlib/source/lux/data/text/encoding/utf8.lux index f0c15df01..6f84dfa64 100644 --- a/stdlib/source/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/lux/data/text/encoding/utf8.lux @@ -156,7 +156,7 @@ ..utf8->string #try.Success)}))) -(structure: #export codec +(implementation: #export codec (Codec Binary Text) (def: encode ..encode) diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index 398b58aa0..6deb80074 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -42,7 +42,7 @@ {#.doc "A way to produce readable text from values."} (-> a Text)) -(structure: #export functor +(implementation: #export functor (contravariant.Functor Format) (def: (map f fb) diff --git a/stdlib/source/lux/data/text/unicode/block.lux b/stdlib/source/lux/data/text/unicode/block.lux index fff262f93..76fe97b78 100644 --- a/stdlib/source/lux/data/text/unicode/block.lux +++ b/stdlib/source/lux/data/text/unicode/block.lux @@ -16,7 +16,7 @@ (abstract: #export Block (Interval Char) - (structure: #export monoid + (implementation: #export monoid (Monoid Block) (def: identity @@ -55,14 +55,14 @@ (interval.within? (:representation block) char)) ) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Block) (def: (= reference subject) (and (n.= (..start reference) (..start subject)) (n.= (..end reference) (..end subject))))) -(structure: #export hash +(implementation: #export hash (Hash Block) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/data/text/unicode/set.lux b/stdlib/source/lux/data/text/unicode/set.lux index c7b5748e4..c7cace208 100644 --- a/stdlib/source/lux/data/text/unicode/set.lux +++ b/stdlib/source/lux/data/text/unicode/set.lux @@ -218,7 +218,7 @@ (recur right))) false))) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Set) (def: (= reference subject) diff --git a/stdlib/source/lux/data/trace.lux b/stdlib/source/lux/data/trace.lux index 3467ee5dd..1b2f87ddf 100644 --- a/stdlib/source/lux/data/trace.lux +++ b/stdlib/source/lux/data/trace.lux @@ -10,11 +10,11 @@ {#monoid (Monoid t) #trace (-> t a)}) -(structure: #export functor (All [t] (Functor (Trace t))) +(implementation: #export functor (All [t] (Functor (Trace t))) (def: (map f fa) (update@ #trace (compose f) fa))) -(structure: #export comonad (All [t] (CoMonad (Trace t))) +(implementation: #export comonad (All [t] (CoMonad (Trace t))) (def: &functor ..functor) (def: (unwrap wa) diff --git a/stdlib/source/lux/ffi.jvm.lux b/stdlib/source/lux/ffi.jvm.lux index 69a9ea5a3..34c33f1d2 100644 --- a/stdlib/source/lux/ffi.jvm.lux +++ b/stdlib/source/lux/ffi.jvm.lux @@ -1,5 +1,5 @@ (.module: - ["." lux (#- Type type int char) + ["." lux (#- Type type int char interface:) ["#_." type ("#\." equivalence)] [abstract ["." monad (#+ Monad do)] diff --git a/stdlib/source/lux/ffi.old.lux b/stdlib/source/lux/ffi.old.lux index a867cd811..6c01ccf3a 100644 --- a/stdlib/source/lux/ffi.old.lux +++ b/stdlib/source/lux/ffi.old.lux @@ -1,5 +1,5 @@ (.module: - [lux (#- type) + [lux (#- type interface:) ["." type ("#\." equivalence)] [abstract ["." monad (#+ Monad do)] diff --git a/stdlib/source/lux/locale/language.lux b/stdlib/source/lux/locale/language.lux index 604363844..7dd4b22e0 100644 --- a/stdlib/source/lux/locale/language.lux +++ b/stdlib/source/lux/locale/language.lux @@ -554,13 +554,13 @@ ["zun" "Zuni" zuni []] ["zza" "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki" zaza [[dimili] [dimli] [kirdki] [kirmanjki] [zazaki]]]]]) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Language) (def: (= reference sample) (is? reference sample))) - (structure: #export hash + (implementation: #export hash (Hash Language) (def: &equivalence diff --git a/stdlib/source/lux/locale/territory.lux b/stdlib/source/lux/locale/territory.lux index 134856659..dfb20896c 100644 --- a/stdlib/source/lux/locale/territory.lux +++ b/stdlib/source/lux/locale/territory.lux @@ -293,13 +293,13 @@ ["ZW" "ZWE" 716 "Zimbabwe" zimbabwe []] ) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Territory) (def: (= reference sample) (is? reference sample))) - (structure: #export hash + (implementation: #export hash (Hash Territory) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 9249198d7..a17b38233 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -61,7 +61,7 @@ [local_identifier #.Identifier "Produces a local identifier (an identifier with no module prefix)."] [local_tag #.Tag "Produces a local tag (a tag with no module prefix)."]) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Code) (def: (= x y) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index f5c83a792..d29966a87 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -77,7 +77,7 @@ (` ((~ (code.identifier poly_func)) (~+ (list\map code.identifier poly_args)))))]] (wrap (.list (` (def: (~+ (|export|.format export)) (~ (code.identifier ["" name])) - {#.struct? #1} + {#.implementation? #1} (~ impl))))))) (def: #export (to_code env type) diff --git a/stdlib/source/lux/math/logic/continuous.lux b/stdlib/source/lux/math/logic/continuous.lux index 5d5c8668d..445bd8447 100644 --- a/stdlib/source/lux/math/logic/continuous.lux +++ b/stdlib/source/lux/math/logic/continuous.lux @@ -14,7 +14,7 @@ (-> Rev Rev Rev) <chooser>) - (structure: #export <monoid> + (implementation: #export <monoid> (Monoid Rev) (def: identity <identity>) diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux index cbe54fae5..5308786fa 100644 --- a/stdlib/source/lux/math/logic/fuzzy.lux +++ b/stdlib/source/lux/math/logic/fuzzy.lux @@ -17,7 +17,7 @@ (type: #export (Fuzzy a) (-> a Rev)) -(structure: #export functor +(implementation: #export functor (contravariant.Functor Fuzzy) (def: (map f fb) diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index 088201e94..5ecfb6763 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -60,7 +60,7 @@ (<>.codec i.decimal (<text>.and (<text>.one_of "-+") (<text>.many <text>.decimal)))) - (structure: #export (codec expected) + (implementation: #export (codec expected) (All [%] (-> (Modulus %) (Codec Text (Mod %)))) (def: (encode modular) @@ -92,12 +92,12 @@ [>= i.>=] ) - (structure: #export equivalence + (implementation: #export equivalence (All [%] (Equivalence (Mod %))) (def: = ..=)) - (structure: #export order + (implementation: #export order (All [%] (Order (Mod %))) (def: &equivalence ..equivalence) @@ -119,7 +119,7 @@ ) (template [<composition> <identity> <monoid>] - [(structure: #export (<monoid> modulus) + [(implementation: #export (<monoid> modulus) (All [%] (-> (Modulus %) (Monoid (Mod %)))) (def: identity diff --git a/stdlib/source/lux/math/number/complex.lux b/stdlib/source/lux/math/number/complex.lux index aad6a4364..279f6177a 100644 --- a/stdlib/source/lux/math/number/complex.lux +++ b/stdlib/source/lux/math/number/complex.lux @@ -69,7 +69,7 @@ [- f.-] ) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Complex) (def: = ..=)) diff --git a/stdlib/source/lux/math/number/frac.lux b/stdlib/source/lux/math/number/frac.lux index 78c5bdde4..4c25d5ca7 100644 --- a/stdlib/source/lux/math/number/frac.lux +++ b/stdlib/source/lux/math/number/frac.lux @@ -132,12 +132,12 @@ "lux f64 i64" ("lux i64 left-shift" ..exponent_size))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Frac) (def: = ..=)) -(structure: #export order +(implementation: #export order (Order Frac) (def: &equivalence ..equivalence) @@ -157,7 +157,7 @@ (..* f2^+1023)))) (template [<name> <compose> <identity>] - [(structure: #export <name> + [(implementation: #export <name> (Monoid Frac) (def: identity <identity>) @@ -195,7 +195,7 @@ (..= ..positive_infinity value) (..= ..negative_infinity value)))) -(structure: #export decimal +(implementation: #export decimal (Codec Text Frac) (def: (encode x) @@ -369,7 +369,7 @@ (#try.Success [representation +0]))) (template [<struct> <nat> <int> <error>] - [(structure: #export <struct> + [(implementation: #export <struct> (Codec Text Frac) (def: (encode value) @@ -422,7 +422,7 @@ [hex //nat.hex //int.hex "Invalid hexadecimal syntax: "] ) -(structure: #export hash +(implementation: #export hash (Hash Frac) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/math/number/i64.lux b/stdlib/source/lux/math/number/i64.lux index e8dde83e0..9d36e3bb1 100644 --- a/stdlib/source/lux/math/number/i64.lux +++ b/stdlib/source/lux/math/number/i64.lux @@ -120,13 +120,13 @@ (-> Nat Nat Mask) (..left_shift offset (..mask size))) -(structure: #export equivalence +(implementation: #export equivalence (All [a] (Equivalence (I64 a))) (def: (= reference sample) ("lux i64 =" reference sample))) -(structure: #export hash +(implementation: #export hash (All [a] (Hash (I64 a))) (def: &equivalence ..equivalence) @@ -134,7 +134,7 @@ (def: hash .nat)) (template [<monoid> <identity> <compose>] - [(structure: #export <monoid> + [(implementation: #export <monoid> (All [a] (Monoid (I64 a))) (def: identity <identity>) @@ -181,7 +181,7 @@ swap/02 swap/01))) -(signature: #export (Sub size) +(interface: #export (Sub size) (: (Equivalence (I64 size)) &equivalence) (: Nat @@ -200,7 +200,7 @@ mantissa (..mask (dec width)) co_mantissa (..xor (.i64 -1) mantissa)] (#.Some (: Sub - (structure + (implementation (def: &equivalence ..equivalence) (def: width width) (def: (narrow value) diff --git a/stdlib/source/lux/math/number/int.lux b/stdlib/source/lux/math/number/int.lux index b121fc216..708ab8dd4 100644 --- a/stdlib/source/lux/math/number/int.lux +++ b/stdlib/source/lux/math/number/int.lux @@ -163,18 +163,18 @@ (-> Int Frac) (|>> "lux i64 f64")) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Int) (def: = ..=)) -(structure: #export order +(implementation: #export order (Order Int) (def: &equivalence ..equivalence) (def: < ..<)) -(structure: #export enum +(implementation: #export enum (Enum Int) (def: &order ..order) @@ -182,7 +182,7 @@ (def: pred dec)) ## TODO: Find out why the numeric literals fail during JS compilation. -(structure: #export interval +(implementation: #export interval (Interval Int) (def: &enum ..enum) @@ -196,7 +196,7 @@ (//i64.left_shift 63 +1))) (template [<name> <compose> <identity>] - [(structure: #export <name> + [(implementation: #export <name> (Monoid Int) (def: identity <identity>) @@ -212,7 +212,7 @@ (def: +sign "+") (template [<struct> <codec> <error>] - [(structure: #export <struct> + [(implementation: #export <struct> (Codec Text Int) (def: (encode value) @@ -246,7 +246,7 @@ [hex //nat.hex "Invalid hexadecimal syntax for Int: "] ) -(structure: #export hash +(implementation: #export hash (Hash Int) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/math/number/nat.lux b/stdlib/source/lux/math/number/nat.lux index d0fb348fa..01a8cff2e 100644 --- a/stdlib/source/lux/math/number/nat.lux +++ b/stdlib/source/lux/math/number/nat.lux @@ -155,25 +155,25 @@ (-> Nat Frac) (|>> .int "lux i64 f64")) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Nat) (def: = ..=)) -(structure: #export order +(implementation: #export order (Order Nat) (def: &equivalence ..equivalence) (def: < ..<)) -(structure: #export enum +(implementation: #export enum (Enum Nat) (def: &order ..order) (def: succ inc) (def: pred dec)) -(structure: #export interval +(implementation: #export interval (Interval Nat) (def: &enum ..enum) @@ -181,7 +181,7 @@ (def: bottom 0)) (template [<name> <compose> <identity>] - [(structure: #export <name> + [(implementation: #export <name> (Monoid Nat) (def: identity <identity>) @@ -299,7 +299,7 @@ _ #.None)) (template [<shift> <struct> <to-character> <to-value> <error>] - [(structure: #export <struct> + [(implementation: #export <struct> (Codec Text Nat) (def: encode @@ -340,7 +340,7 @@ [4 hex hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Nat: "] ) -(structure: #export decimal +(implementation: #export decimal (Codec Text Nat) (def: (encode value) @@ -372,7 +372,7 @@ (#try.Success output))) <failure>))))) -(structure: #export hash +(implementation: #export hash (Hash Nat) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/math/number/ratio.lux b/stdlib/source/lux/math/number/ratio.lux index d754f6df4..ad2092fbd 100644 --- a/stdlib/source/lux/math/number/ratio.lux +++ b/stdlib/source/lux/math/number/ratio.lux @@ -54,7 +54,7 @@ (n.= (get@ #denominator parameter) (get@ #denominator subject)))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Ratio) (def: = ..=)) @@ -85,7 +85,7 @@ (or (> parameter subject) (= parameter subject))) -(structure: #export order +(implementation: #export order (Order Ratio) (def: &equivalence ..equivalence) @@ -131,7 +131,7 @@ (def: separator ":") -(structure: #export codec +(implementation: #export codec (Codec Text Ratio) (def: (encode (^slots [#numerator #denominator])) @@ -150,7 +150,7 @@ (#.Left (text\compose "Invalid syntax for ratio: " input))))) (template [<identity> <compose> <name>] - [(structure: #export <name> + [(implementation: #export <name> (Monoid Ratio) (def: identity (..ratio <identity>)) diff --git a/stdlib/source/lux/math/number/rev.lux b/stdlib/source/lux/math/number/rev.lux index 78d80767b..0f96320e3 100644 --- a/stdlib/source/lux/math/number/rev.lux +++ b/stdlib/source/lux/math/number/rev.lux @@ -183,31 +183,31 @@ (-> Rev Frac) (|>> ..mantissa ("lux f64 /" ..frac_denominator))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Rev) (def: = ..=)) -(structure: #export hash +(implementation: #export hash (Hash Rev) (def: &equivalence ..equivalence) (def: hash .nat)) -(structure: #export order +(implementation: #export order (Order Rev) (def: &equivalence ..equivalence) (def: < ..<)) -(structure: #export enum +(implementation: #export enum (Enum Rev) (def: &order ..order) (def: succ inc) (def: pred dec)) -(structure: #export interval +(implementation: #export interval (Interval Rev) (def: &enum ..enum) @@ -215,7 +215,7 @@ (def: bottom (.rev 0))) (template [<name> <compose> <identity>] - [(structure: #export <name> + [(implementation: #export <name> (Monoid Rev) (def: identity (\ interval <identity>)) @@ -232,7 +232,7 @@ (template [<struct> <codec> <char_bit_size> <error>] [(with_expansions [<error_output> (as_is (#try.Failure ("lux text concat" <error> repr)))] - (structure: #export <struct> + (implementation: #export <struct> (Codec Text Rev) (def: (encode value) @@ -408,7 +408,7 @@ (digits::-!' idx (digits::get idx param) output)) output))) -(structure: #export decimal +(implementation: #export decimal (Codec Text Rev) (def: (encode input) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 39fab5a29..9ed201d95 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -44,7 +44,7 @@ {#.doc "A producer of random values based on a PRNG."} (-> PRNG [PRNG a])) -(structure: #export functor +(implementation: #export functor (Functor Random) (def: (map f fa) @@ -52,7 +52,7 @@ (let [[state' a] (fa state)] [state' (f a)])))) -(structure: #export apply +(implementation: #export apply (Apply Random) (def: &functor ..functor) @@ -63,7 +63,7 @@ [state'' a] (fa state')] [state'' (f a)])))) -(structure: #export monad +(implementation: #export monad (Monad Random) (def: &functor ..functor) diff --git a/stdlib/source/lux/meta.lux b/stdlib/source/lux/meta.lux index d7788bd13..b9105fa45 100644 --- a/stdlib/source/lux/meta.lux +++ b/stdlib/source/lux/meta.lux @@ -27,7 +27,7 @@ ## (type: (Meta a) ## (-> Lux (Try [Lux a]))) -(structure: #export functor +(implementation: #export functor (Functor Meta) (def: (map f fa) @@ -39,7 +39,7 @@ (#try.Success [compiler' a]) (#try.Success [compiler' (f a)]))))) -(structure: #export apply +(implementation: #export apply (Apply Meta) (def: &functor ..functor) @@ -58,7 +58,7 @@ (#try.Failure msg) (#try.Failure msg))))) -(structure: #export monad +(implementation: #export monad (Monad Meta) (def: &functor ..functor) diff --git a/stdlib/source/lux/meta/annotation.lux b/stdlib/source/lux/meta/annotation.lux index 3f0527f74..648119177 100644 --- a/stdlib/source/lux/meta/annotation.lux +++ b/stdlib/source/lux/meta/annotation.lux @@ -67,7 +67,7 @@ (-> Annotation Bit) (..flagged? (name_of <tag>)))] - [structure? #.struct?] + [implementation? #.implementation?] [recursive_type? #.type-rec?] [signature? #.sig?] ) diff --git a/stdlib/source/lux/meta/location.lux b/stdlib/source/lux/meta/location.lux index 3ddbeac6a..5e8453c50 100644 --- a/stdlib/source/lux/meta/location.lux +++ b/stdlib/source/lux/meta/location.lux @@ -3,7 +3,7 @@ [abstract [equivalence (#+ Equivalence)]]]) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Location) (def: (= reference subject) diff --git a/stdlib/source/lux/target.lux b/stdlib/source/lux/target.lux index 572c95c90..c548e6809 100644 --- a/stdlib/source/lux/target.lux +++ b/stdlib/source/lux/target.lux @@ -9,16 +9,17 @@ Target <value>)] - ## TODO: Delete ASAP + ## TODO: Delete ASAP. [old "{old}"] - - [common_lisp "Common Lisp"] + ## Available. [js "JavaScript"] [jvm "JVM"] [lua "Lua"] - [php "PHP"] [python "Python"] - [r "R"] [ruby "Ruby"] + ## Not available yet. + [common_lisp "Common Lisp"] + [php "PHP"] + [r "R"] [scheme "Scheme"] ) diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux index d79ba042a..eb78bc024 100644 --- a/stdlib/source/lux/target/jvm/bytecode.lux +++ b/stdlib/source/lux/target/jvm/bytecode.lux @@ -76,7 +76,7 @@ Relative (function.constant (#try.Success [..no_exceptions _.empty]))) -(structure: relative_monoid +(implementation: relative_monoid (Monoid Relative) (def: identity ..relative_identity) diff --git a/stdlib/source/lux/target/jvm/bytecode/address.lux b/stdlib/source/lux/target/jvm/bytecode/address.lux index b434403f1..b158bbd05 100644 --- a/stdlib/source/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/lux/target/jvm/bytecode/address.lux @@ -55,7 +55,7 @@ (n.> (|> reference :representation ///unsigned.value) (|> subject :representation ///unsigned.value))) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Address) (def: (= reference subject) diff --git a/stdlib/source/lux/target/jvm/bytecode/environment.lux b/stdlib/source/lux/target/jvm/bytecode/environment.lux index 932fe0e28..23bcb4558 100644 --- a/stdlib/source/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/lux/target/jvm/bytecode/environment.lux @@ -35,7 +35,7 @@ (type: #export Condition (-> Environment (Try Environment))) -(structure: #export monoid +(implementation: #export monoid (Monoid Condition) (def: identity (|>> #try.Success)) diff --git a/stdlib/source/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/lux/target/jvm/bytecode/instruction.lux index 218d14dab..718f14199 100644 --- a/stdlib/source/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/lux/target/jvm/bytecode/instruction.lux @@ -704,7 +704,7 @@ size) (|>> mutation lookupswitch_mutation)]))))])) -(structure: #export monoid +(implementation: #export monoid (Monoid Instruction) (def: identity ..empty) diff --git a/stdlib/source/lux/target/jvm/constant.lux b/stdlib/source/lux/target/jvm/constant.lux index 5d44dfbd6..d0280cb27 100644 --- a/stdlib/source/lux/target/jvm/constant.lux +++ b/stdlib/source/lux/target/jvm/constant.lux @@ -65,7 +65,7 @@ ["#::." (#static floatToRawIntBits #manual [float] int)]) -(structure: #export float_equivalence +(implementation: #export float_equivalence (Equivalence java/lang/Float) (def: (= parameter subject) @@ -174,9 +174,9 @@ (def: #export equivalence (Equivalence Constant) - ## TODO: Delete the explicit "structure" and use the combinator + ## TODO: Delete the explicit "implementation" and use the combinator ## version below as soon as the new format for variants is implemented. - (structure + (implementation (def: (= reference sample) (case [reference sample] (^template [<tag> <equivalence>] diff --git a/stdlib/source/lux/target/jvm/constant/tag.lux b/stdlib/source/lux/target/jvm/constant/tag.lux index a35ff3438..011e38374 100644 --- a/stdlib/source/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/lux/target/jvm/constant/tag.lux @@ -16,7 +16,7 @@ (abstract: #export Tag U1 - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Tag) (def: (= reference sample) (u1//= (:representation reference) diff --git a/stdlib/source/lux/target/jvm/encoding/signed.lux b/stdlib/source/lux/target/jvm/encoding/signed.lux index 7ce06ac28..934d48ce2 100644 --- a/stdlib/source/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/lux/target/jvm/encoding/signed.lux @@ -28,12 +28,12 @@ (-> (Signed Any) Int) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (All [brand] (Equivalence (Signed brand))) (def: (= reference sample) (i.= (:representation reference) (:representation sample)))) - (structure: #export order + (implementation: #export order (All [brand] (Order (Signed brand))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/lux/target/jvm/encoding/unsigned.lux index 1c2edd25a..4cff01d68 100644 --- a/stdlib/source/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/lux/target/jvm/encoding/unsigned.lux @@ -27,13 +27,13 @@ (-> (Unsigned Any) Nat) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (All [brand] (Equivalence (Unsigned brand))) (def: (= reference sample) (n.= (:representation reference) (:representation sample)))) - (structure: #export order + (implementation: #export order (All [brand] (Order (Unsigned brand))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/jvm/modifier.lux b/stdlib/source/lux/target/jvm/modifier.lux index 526efaf4f..80e353f33 100644 --- a/stdlib/source/lux/target/jvm/modifier.lux +++ b/stdlib/source/lux/target/jvm/modifier.lux @@ -29,7 +29,7 @@ (-> (Modifier Any) //unsigned.U2) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (All [of] (Equivalence (Modifier of))) (def: (= reference sample) @@ -55,7 +55,7 @@ (i64.and sub) (\ i64.equivalence = sub)))) - (structure: #export monoid + (implementation: #export monoid (All [of] (Monoid (Modifier of))) (def: identity diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux index 589b1201a..38645ef06 100644 --- a/stdlib/source/lux/target/jvm/type.lux +++ b/stdlib/source/lux/target/jvm/type.lux @@ -142,7 +142,7 @@ (..descriptor output)]) (:assume ..void)])) - (structure: #export equivalence + (implementation: #export equivalence (All [category] (Equivalence (Type category))) (def: (= parameter subject) @@ -150,7 +150,7 @@ (..signature parameter) (..signature subject)))) - (structure: #export hash + (implementation: #export hash (All [category] (Hash (Type category))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/jvm/type/descriptor.lux b/stdlib/source/lux/target/jvm/type/descriptor.lux index 983894ed4..d8d5ea256 100644 --- a/stdlib/source/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/lux/target/jvm/type/descriptor.lux @@ -98,7 +98,7 @@ (text.enclose ["(" ")"])) (:representation output)))) - (structure: #export equivalence + (implementation: #export equivalence (All [category] (Equivalence (Descriptor category))) (def: (= parameter subject) diff --git a/stdlib/source/lux/target/jvm/type/reflection.lux b/stdlib/source/lux/target/jvm/type/reflection.lux index 17d5a219f..7d775b1f9 100644 --- a/stdlib/source/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/lux/target/jvm/type/reflection.lux @@ -21,7 +21,7 @@ (-> (Reflection Any) Text) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (All [category] (Equivalence (Reflection category))) (def: (= parameter subject) diff --git a/stdlib/source/lux/target/jvm/type/signature.lux b/stdlib/source/lux/target/jvm/type/signature.lux index 8ddef8f4f..ab207bc39 100644 --- a/stdlib/source/lux/target/jvm/type/signature.lux +++ b/stdlib/source/lux/target/jvm/type/signature.lux @@ -118,14 +118,14 @@ (list\map (|>> :representation (format ..exception_prefix))) (text.join_with ""))))) - (structure: #export equivalence + (implementation: #export equivalence (All [category] (Equivalence (Signature category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) - (structure: #export hash + (implementation: #export hash (All [category] (Hash (Signature category))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/lua.lux b/stdlib/source/lux/target/lua.lux index 144fc2d7b..fe675da0f 100644 --- a/stdlib/source/lux/target/lua.lux +++ b/stdlib/source/lux/target/lua.lux @@ -37,13 +37,13 @@ (abstract: #export (Code brand) Text - (structure: #export equivalence + (implementation: #export equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (structure: #export hash + (implementation: #export hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/php.lux b/stdlib/source/lux/target/php.lux index 5b976a325..2796a4fb9 100644 --- a/stdlib/source/lux/target/php.lux +++ b/stdlib/source/lux/target/php.lux @@ -45,13 +45,13 @@ (abstract: #export (Code brand) Text - (structure: #export equivalence + (implementation: #export equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (structure: #export hash + (implementation: #export hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/python.lux b/stdlib/source/lux/target/python.lux index 516cc261f..54e524538 100644 --- a/stdlib/source/lux/target/python.lux +++ b/stdlib/source/lux/target/python.lux @@ -49,13 +49,13 @@ (abstract: #export (Code brand) Text - (structure: #export equivalence + (implementation: #export equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (structure: #export hash + (implementation: #export hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/target/ruby.lux b/stdlib/source/lux/target/ruby.lux index 21a47c8d0..e23c64fc0 100644 --- a/stdlib/source/lux/target/ruby.lux +++ b/stdlib/source/lux/target/ruby.lux @@ -37,13 +37,13 @@ (abstract: #export (Code brand) Text - (structure: #export code_equivalence + (implementation: #export code_equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (structure: #export code_hash + (implementation: #export code_hash (All [brand] (Hash (Code brand))) (def: &equivalence ..code_equivalence) diff --git a/stdlib/source/lux/target/scheme.lux b/stdlib/source/lux/target/scheme.lux index 651fca21d..a34023c6a 100644 --- a/stdlib/source/lux/target/scheme.lux +++ b/stdlib/source/lux/target/scheme.lux @@ -28,13 +28,13 @@ (abstract: #export (Code k) Text - (structure: #export equivalence + (implementation: #export equivalence (All [brand] (Equivalence (Code brand))) (def: (= reference subject) (\ text.equivalence = (:representation reference) (:representation subject)))) - (structure: #export hash + (implementation: #export hash (All [brand] (Hash (Code brand))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/time.lux b/stdlib/source/lux/time.lux index fe08164d0..f1600bc56 100644 --- a/stdlib/source/lux/time.lux +++ b/stdlib/source/lux/time.lux @@ -96,13 +96,13 @@ (-> Time Nat) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Time) (def: (= param subject) (n.= (:representation param) (:representation subject)))) - (structure: #export order + (implementation: #export order (Order Time) (def: &equivalence ..equivalence) @@ -110,7 +110,7 @@ (def: (< param subject) (n.< (:representation param) (:representation subject)))) - (`` (structure: #export enum + (`` (implementation: #export enum (Enum Time) (def: &order ..order) @@ -206,7 +206,7 @@ ..separator (..pad second) (..encode_millis milli_second)))) -(structure: #export codec +(implementation: #export codec {#.doc (doc "Based on ISO 8601." "For example: 21:14:51.827")} (Codec Text Time) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 872f91f13..88171fd9f 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -96,7 +96,7 @@ [day_of_month Nat #day] ) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Date) (def: (= reference sample) @@ -111,7 +111,7 @@ (n.= (get@ #day reference) (get@ #day sample)))))) - (structure: #export order + (implementation: #export order (Order Date) (def: &equivalence ..equivalence) @@ -183,7 +183,7 @@ ..separator (..pad (|> value ..month //month.number)) ..separator (..pad (..day_of_month value)))) -(structure: #export codec +(implementation: #export codec {#.doc (doc "Based on ISO 8601." "For example: 2017-01-15")} (Codec Text Date) @@ -335,7 +335,7 @@ (maybe.assume (dictionary.get month ..month_by_number)) day)))) -(structure: #export enum +(implementation: #export enum (Enum Date) (def: &order ..order) diff --git a/stdlib/source/lux/time/day.lux b/stdlib/source/lux/time/day.lux index 94b1dcabd..602c9261f 100644 --- a/stdlib/source/lux/time/day.lux +++ b/stdlib/source/lux/time/day.lux @@ -23,7 +23,7 @@ #Friday #Saturday) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Day) (def: (= reference sample) @@ -53,7 +53,7 @@ #Friday 5 #Saturday 6)) -(structure: #export order +(implementation: #export order (Order Day) (def: &equivalence ..equivalence) @@ -61,7 +61,7 @@ (def: (< reference sample) (n.< (..nat reference) (..nat sample)))) -(structure: #export enum +(implementation: #export enum (Enum Day) (def: &order ..order) @@ -90,7 +90,7 @@ (exception.report ["Value" (text.format value)])) -(structure: #export codec +(implementation: #export codec (Codec Text Day) (def: (encode value) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index cd591a8a1..f1fcd932c 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -61,13 +61,13 @@ (-> Duration Duration Int) (i./ (:representation param) (:representation subject))) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Duration) (def: (= param subject) (i.= (:representation param) (:representation subject)))) - (structure: #export order + (implementation: #export order (Order Duration) (def: &equivalence ..equivalence) @@ -107,7 +107,7 @@ (def: #export leap_year (..merge ..day ..normal_year)) -(structure: #export monoid +(implementation: #export monoid (Monoid Duration) (def: identity ..empty) @@ -182,7 +182,7 @@ (#.Left _) (..inverse span) (#.Right _) span))))) -(structure: #export codec +(implementation: #export codec (Codec Text Duration) (def: encode ..encode) @@ -192,7 +192,7 @@ (-> Duration Duration Duration) (|> from ..inverse (..merge to))) -(structure: #export enum +(implementation: #export enum (Enum Duration) (def: &order ..order) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 78dcadde1..61cadce14 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -60,20 +60,20 @@ (-> Duration Instant) (|> offset duration.to_millis :abstraction)) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Instant) (def: (= param subject) (\ i.equivalence = (:representation param) (:representation subject)))) - (structure: #export order + (implementation: #export order (Order Instant) (def: &equivalence ..equivalence) (def: (< param subject) (\ i.order < (:representation param) (:representation subject)))) - (`` (structure: #export enum + (`` (implementation: #export enum (Enum Instant) (def: &order ..order) @@ -143,7 +143,7 @@ (duration.merge (duration.up time duration.milli_second)) ..absolute)))) -(structure: #export codec +(implementation: #export codec {#.doc (doc "Based on ISO 8601." "For example: 2017-01-15T21:14:51.827Z")} (Codec Text Instant) diff --git a/stdlib/source/lux/time/month.lux b/stdlib/source/lux/time/month.lux index 34be47c1c..898a3df84 100644 --- a/stdlib/source/lux/time/month.lux +++ b/stdlib/source/lux/time/month.lux @@ -29,7 +29,7 @@ #November #December) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Month) (def: (= reference sample) @@ -89,13 +89,13 @@ _ (exception.throw ..invalid_month [number]))) ) -(structure: #export hash +(implementation: #export hash (Hash Month) (def: &equivalence ..equivalence) (def: hash ..number)) -(structure: #export order +(implementation: #export order (Order Month) (def: &equivalence ..equivalence) @@ -103,7 +103,7 @@ (def: (< reference sample) (n.< (..number reference) (..number sample)))) -(structure: #export enum +(implementation: #export enum (Enum Month) (def: &order ..order) @@ -184,7 +184,7 @@ (exception.report ["Value" (text.format value)])) -(structure: #export codec +(implementation: #export codec (Codec Text Month) (def: (encode value) diff --git a/stdlib/source/lux/time/year.lux b/stdlib/source/lux/time/year.lux index 3c61756f9..633045510 100644 --- a/stdlib/source/lux/time/year.lux +++ b/stdlib/source/lux/time/year.lux @@ -118,7 +118,7 @@ (#.Left _) (i.* -1 raw-year) (#.Right _) raw-year))))) -(structure: #export codec +(implementation: #export codec {#.doc (doc "Based on ISO 8601." "For example: 2017")} (Codec Text Year) @@ -126,13 +126,13 @@ (def: encode ..encode) (def: decode (<t>.run ..parser))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Year) (def: (= reference subject) (i.= (..value reference) (..value subject)))) -(structure: #export order +(implementation: #export order (Order Year) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/lux/tool/compiler/language/lux/analysis.lux index d2382537a..bbbe43b27 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/analysis.lux @@ -106,7 +106,7 @@ (type: #export Match (Match' Analysis)) -(structure: primitive_equivalence +(implementation: primitive_equivalence (Equivalence Primitive) (def: (= reference sample) @@ -127,7 +127,7 @@ _ false))) -(structure: #export (composite_equivalence (^open "/\.")) +(implementation: #export (composite_equivalence (^open "/\.")) (All [a] (-> (Equivalence a) (Equivalence (Composite a)))) (def: (= reference sample) @@ -144,7 +144,7 @@ _ false))) -(structure: #export (composite_hash super) +(implementation: #export (composite_hash super) (All [a] (-> (Hash a) (Hash (Composite a)))) (def: &equivalence @@ -163,7 +163,7 @@ (\ (list.hash super) hash members)) ))) -(structure: pattern_equivalence +(implementation: pattern_equivalence (Equivalence Pattern) (def: (= reference sample) @@ -180,14 +180,14 @@ _ false))) -(structure: (branch_equivalence equivalence) +(implementation: (branch_equivalence equivalence) (-> (Equivalence Analysis) (Equivalence Branch)) (def: (= [reference_pattern reference_body] [sample_pattern sample_body]) (and (\ pattern_equivalence = reference_pattern sample_pattern) (\ equivalence = reference_body sample_body)))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Analysis) (def: (= reference sample) diff --git a/stdlib/source/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/lux/tool/compiler/language/lux/generation.lux index 8606b5701..372ed2c17 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/generation.lux @@ -48,7 +48,7 @@ [no_buffer_for_saving_code] ) -(signature: #export (Host expression directive) +(interface: #export (Host expression directive) (: (-> Context expression (Try Any)) evaluate!) (: (-> directive (Try Any)) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index af5a12c37..4a3afc3f5 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -177,7 +177,7 @@ _ (list coverage))) -(structure: equivalence (Equivalence Coverage) +(implementation: equivalence (Equivalence Coverage) (def: (= reference sample) (case [reference sample] [#Exhaustive #Exhaustive] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux index 977396fab..2e4488b00 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common_lisp/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System (Expression Any)) (def: constant _.var) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/reference.lux index b748318e5..6361e3d09 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System Expression) (def: constant _.var) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index 12954ff51..0e7a2c776 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -147,7 +147,7 @@ (io (let [library (loader.new-library []) loader (loader.memory library)] (: //runtime.Host - (structure + (implementation (def: (evaluate! temp-label valueG) (let [eval-class (|> temp-label name.normalize (text.replace-all " " "$"))] (\ try.monad map product.left diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux index 965ac68b3..72a54569c 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System Expression) (def: constant _.var) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/reference.lux index 776245b61..de532a9dc 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System Expression) (def: constant _.global) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/reference.lux index 0f7629614..1fe57fb8c 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System (Expression Any)) (def: constant _.var) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/r/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/r/reference.lux index c3f2e8289..c986bc2a0 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/r/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/r/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System Expression) (def: constant _.var) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux index 9cca8b8e5..cdcc5a134 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -43,7 +43,7 @@ "m" (%.nat module) "a" (%.nat artifact))) -(signature: #export (System expression) +(interface: #export (System expression) (: (-> Text expression) constant) (: (-> Text expression) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux index 1149b2e8d..1ea2cca00 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System Expression) (def: constant _.global) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux index 4e8ae26cf..f24134d9f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/reference.lux @@ -5,7 +5,7 @@ [/// [reference (#+ System)]]) -(structure: #export system +(implementation: #export system (System Expression) (def: constant _.var) diff --git a/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux index 5b79a72a8..0b2086f25 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/synthesis.lux @@ -412,7 +412,7 @@ (Format Path) (%path' %synthesis)) -(structure: #export primitive_equivalence +(implementation: #export primitive_equivalence (Equivalence Primitive) (def: (= reference sample) @@ -430,7 +430,7 @@ _ false))) -(structure: primitive_hash +(implementation: primitive_hash (Hash Primitive) (def: &equivalence ..primitive_equivalence) @@ -456,7 +456,7 @@ (Hash Member) (sum.hash n.hash n.hash)) -(structure: #export access_equivalence +(implementation: #export access_equivalence (Equivalence Access) (def: (= reference sample) @@ -470,7 +470,7 @@ _ false))) -(structure: access_hash +(implementation: access_hash (Hash Access) (def: &equivalence ..access_equivalence) @@ -484,7 +484,7 @@ ([#Side] [#Member]))))) -(structure: #export (path'_equivalence equivalence) +(implementation: #export (path'_equivalence equivalence) (All [a] (-> (Equivalence a) (Equivalence (Path' a)))) (def: (= reference sample) @@ -527,7 +527,7 @@ _ false))) -(structure: (path'_hash super) +(implementation: (path'_hash super) (All [a] (-> (Hash a) (Hash (Path' a)))) (def: &equivalence @@ -572,7 +572,7 @@ (n.* 29 (\ super hash body)) ))) -(structure: (branch_equivalence (^open "\.")) +(implementation: (branch_equivalence (^open "\.")) (All [a] (-> (Equivalence a) (Equivalence (Branch a)))) (def: (= reference sample) @@ -602,7 +602,7 @@ _ false))) -(structure: (branch_hash super) +(implementation: (branch_hash super) (All [a] (-> (Hash a) (Hash (Branch a)))) (def: &equivalence @@ -633,7 +633,7 @@ (\ (..path'_hash super) hash path)) ))) -(structure: (loop_equivalence (^open "\.")) +(implementation: (loop_equivalence (^open "\.")) (All [a] (-> (Equivalence a) (Equivalence (Loop a)))) (def: (= reference sample) @@ -650,7 +650,7 @@ _ false))) -(structure: (loop_hash super) +(implementation: (loop_hash super) (All [a] (-> (Hash a) (Hash (Loop a)))) (def: &equivalence @@ -669,7 +669,7 @@ (\ (list.hash super) hash resets)) ))) -(structure: (function_equivalence (^open "\.")) +(implementation: (function_equivalence (^open "\.")) (All [a] (-> (Equivalence a) (Equivalence (Function a)))) (def: (= reference sample) @@ -688,7 +688,7 @@ _ false))) -(structure: (function_hash super) +(implementation: (function_hash super) (All [a] (-> (Hash a) (Hash (Function a)))) (def: &equivalence @@ -708,7 +708,7 @@ (\ (list.hash super) hash arguments)) ))) -(structure: (control_equivalence (^open "\.")) +(implementation: (control_equivalence (^open "\.")) (All [a] (-> (Equivalence a) (Equivalence (Control a)))) (def: (= reference sample) @@ -723,7 +723,7 @@ _ false))) -(structure: (control_hash super) +(implementation: (control_hash super) (All [a] (-> (Hash a) (Hash (Control a)))) (def: &equivalence @@ -739,7 +739,7 @@ [5 #Function ..function_hash]) ))) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Synthesis) (def: (= reference sample) @@ -760,7 +760,7 @@ (Equivalence Path) (path'_equivalence equivalence)) -(structure: #export hash +(implementation: #export hash (Hash Synthesis) (def: &equivalence ..equivalence) diff --git a/stdlib/source/lux/tool/compiler/reference.lux b/stdlib/source/lux/tool/compiler/reference.lux index 856435fe8..98a1f0c07 100644 --- a/stdlib/source/lux/tool/compiler/reference.lux +++ b/stdlib/source/lux/tool/compiler/reference.lux @@ -22,7 +22,7 @@ (#Variable Variable) (#Constant Constant)) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Reference) (def: (= reference sample) @@ -36,7 +36,7 @@ _ false))) -(structure: #export hash +(implementation: #export hash (Hash Reference) (def: &equivalence diff --git a/stdlib/source/lux/tool/compiler/reference/variable.lux b/stdlib/source/lux/tool/compiler/reference/variable.lux index 8106d9257..84aea58ab 100644 --- a/stdlib/source/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/lux/tool/compiler/reference/variable.lux @@ -20,7 +20,7 @@ (#Local Register) (#Foreign Register)) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Variable) (def: (= reference sample) @@ -33,7 +33,7 @@ _ #0))) -(structure: #export hash +(implementation: #export hash (Hash Variable) (def: &equivalence diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 72375519d..8142fc524 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -172,7 +172,7 @@ type )) -(structure: #export equivalence +(implementation: #export equivalence (Equivalence Type) (def: (= x y) diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux index 7c5d31bf3..3882591e5 100644 --- a/stdlib/source/lux/type/check.lux +++ b/stdlib/source/lux/type/check.lux @@ -65,7 +65,7 @@ (type: Type_Vars (List [Var (Maybe Type)])) -(structure: #export functor +(implementation: #export functor (Functor Check) (def: (map f fa) @@ -77,7 +77,7 @@ (#try.Failure error) (#try.Failure error))))) -(structure: #export apply +(implementation: #export apply (Apply Check) (def: &functor ..functor) @@ -98,7 +98,7 @@ ))) ) -(structure: #export monad +(implementation: #export monad (Monad Check) (def: &functor ..functor) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 2b96b1beb..14f2ac441 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -119,7 +119,7 @@ (def: (prepare_definitions source_module target_module constants aggregate) (-> Text Text (List [Text Definition]) (-> (List [Name Type]) (List [Name Type]))) (list\fold (function (_ [name [exported? def_type def_anns def_value]] aggregate) - (if (and (annotation.structure? def_anns) + (if (and (annotation.implementation? def_anns) (or (text\= target_module source_module) exported?)) (#.Cons [[source_module name] def_type] aggregate) @@ -318,12 +318,12 @@ {member s.identifier} {args (p.or (p.and (p.some s.identifier) s.end!) (p.and (p.some s.any) s.end!))}) - {#.doc (doc "Automatic structure selection (for type-class style polymorphism)." - "This feature layers type-class style polymorphism on top of Lux's signatures and structures." + {#.doc (doc "Automatic implementation selection (for type-class style polymorphism)." + "This feature layers type-class style polymorphism on top of Lux's signatures and implementations." "When calling a polymorphic function, or using a polymorphic constant," "this macro will check the types of the arguments, and the expected type for the whole expression" "and it will search in the local scope, the module's scope and the imports' scope" - "in order to find suitable structures to satisfy those requirements." + "in order to find suitable implementations to satisfy those requirements." "If a single alternative is found, that one will be used automatically." "If no alternative is found, or if more than one alternative is found (ambiguity)" "a compile-time error will be raised, to alert the user." @@ -339,7 +339,7 @@ (list.indices 10)) "(Functor List) map" (\\ map inc (list.indices 10)) - "Caveat emptor: You need to make sure to import the module of any structure you want to use." + "Caveat emptor: You need to make sure to import the module of any implementation you want to use." "Otherwise, this macro will not find it.")} (case args (#.Left [args _]) @@ -350,7 +350,7 @@ chosen_ones (find_alternatives sig_type member_idx input_types output_type)] (case chosen_ones #.Nil - (meta.fail (format "No structure option could be found for member: " (%.name member))) + (meta.fail (format "No implementation could be found for member: " (%.name member))) (#.Cons chosen #.Nil) (wrap (list (` (\ (~ (instance$ chosen)) @@ -358,7 +358,7 @@ (~+ (list\map code.identifier args)))))) _ - (meta.fail (format "Too many options available: " + (meta.fail (format "Too many implementations available: " (|> chosen_ones (list\map (|>> product.left %.name)) (text.join_with ", ")) @@ -381,20 +381,20 @@ (Parser (List Code)) (s.tuple (p.many s.any))) -(syntax: #export (with {structures ..implicits} body) +(syntax: #export (with {implementations ..implicits} body) (do meta.monad - [g!implicit+ (implicit_bindings (list.size structures))] - (wrap (list (` (let [(~+ (|> (list.zip/2 g!implicit+ structures) - (list\map (function (_ [g!implicit structure]) - (list g!implicit structure))) + [g!implicit+ (implicit_bindings (list.size implementations))] + (wrap (list (` (let [(~+ (|> (list.zip/2 g!implicit+ implementations) + (list\map (function (_ [g!implicit implementation]) + (list g!implicit implementation))) list\join))] (~ body))))))) -(syntax: #export (implicit: {structures ..implicits}) +(syntax: #export (implicit: {implementations ..implicits}) (do meta.monad - [g!implicit+ (implicit_bindings (list.size structures))] - (wrap (|> (list.zip/2 g!implicit+ structures) - (list\map (function (_ [g!implicit structure]) + [g!implicit+ (implicit_bindings (list.size implementations))] + (wrap (|> (list.zip/2 g!implicit+ implementations) + (list\map (function (_ [g!implicit implementation]) (` (def: (~ g!implicit) - {#.struct? #1} - (~ structure))))))))) + {#.implementation? #1} + (~ implementation))))))))) diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index f85f8b56c..dd47b6bf3 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -48,7 +48,7 @@ (..Quotient (~ g!t) (~ g!c) (~ g!%)))))))) -(structure: #export (equivalence super) +(implementation: #export (equivalence super) (All [t c %] (-> (Equivalence c) (Equivalence (..Quotient t c %)))) (def: (= reference sample) diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index 07425c45b..acad33a71 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -44,7 +44,7 @@ (All [keys] (Procedure monad [permissions keys] keys value))) -(structure: (indexed Monad<m>) +(implementation: (indexed Monad<m>) (All [m] (-> (Monad m) (IxMonad (Procedure m)))) (def: (wrap value) diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index cc4cd3f91..ff0dfa645 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -58,13 +58,13 @@ ) ) -(signature: #export (Unit a) +(interface: #export (Unit a) (: (-> Int (Qty a)) in) (: (-> (Qty a) Int) out)) -(signature: #export (Scale s) +(interface: #export (Scale s) (: (All [u] (-> (Qty u) (Qty (s u)))) scale) (: (All [u] (-> (Qty (s u)) (Qty u))) @@ -95,7 +95,7 @@ (~ (|annotations|.format annotations)) (primitive (~ (code.text (%.name [@ type_name])))))) - (` (structure: (~+ (|export|.format export)) (~ (code.local_identifier unit_name)) + (` (implementation: (~+ (|export|.format export)) (~ (code.local_identifier unit_name)) (..Unit (~ g!type)) (def: (~' in) (~! ..in)) @@ -126,7 +126,7 @@ (~ (|annotations|.format annotations)) (primitive (~ (code.text (%.name [@ type_name]))) [(~' u)]))) - (` (structure: (~+ (|export|.format export)) (~ (code.local_identifier scale_name)) + (` (implementation: (~+ (|export|.format export)) (~ (code.local_identifier scale_name)) (..Scale (~ g!scale)) (def: (~' scale) @@ -166,13 +166,13 @@ (unit: #export Litre litre) (unit: #export Second second) -(structure: #export equivalence +(implementation: #export equivalence (All [unit] (Equivalence (Qty unit))) (def: (= reference sample) (i.= (..out reference) (..out sample)))) -(structure: #export order +(implementation: #export order (All [unit] (Order (Qty unit))) (def: &equivalence ..equivalence) @@ -180,7 +180,7 @@ (def: (< reference sample) (i.< (..out reference) (..out sample)))) -(structure: #export enum +(implementation: #export enum (All [unit] (Enum (Qty unit))) (def: &order ..order) diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux index 9cf12bc5c..d4a16e5f6 100644 --- a/stdlib/source/lux/world/console.lux +++ b/stdlib/source/lux/world/console.lux @@ -34,7 +34,7 @@ (capability: #export (Can_Close !) (can_close [] (! (Try Any)))) -(signature: #export (Console !) +(interface: #export (Console !) (: (Can_Read ! Char) read) (: (Can_Read ! Text) @@ -46,15 +46,16 @@ (def: #export (async console) (-> (Console IO) (Console Promise)) - (`` (structure (~~ (template [<capability> <forge>] - [(def: <capability> - (<forge> - (|>> (!.use (\ console <capability>)) promise.future)))] + (`` (implementation + (~~ (template [<capability> <forge>] + [(def: <capability> + (<forge> + (|>> (!.use (\ console <capability>)) promise.future)))] - [read ..can_read] - [read_line ..can_read] - [write ..can_write] - [close ..can_close]))))) + [read ..can_read] + [read_line ..can_read] + [write ..can_write] + [close ..can_close]))))) (with_expansions [<jvm> (as_is (import: java/lang/String) @@ -90,7 +91,7 @@ (<| wrap exception.return (: (Console IO)) ## TODO: Remove ASAP - (structure + (implementation (def: read (..can_read (function (_ _) @@ -119,7 +120,7 @@ (All [!] (-> Text (Console !) (! (Try Any)))) (!.use (\ console write) [(format message text.new_line)])) -(signature: #export (Simulation s) +(interface: #export (Simulation s) (: (-> s (Try [s Char])) on_read) (: (-> s (Try [s Text])) @@ -132,7 +133,7 @@ (def: #export (mock simulation init) (All [s] (-> (Simulation s) s (Console IO))) (let [state (atom.atom init)] - (`` (structure + (`` (implementation (~~ (template [<method> <simulation>] [(def: <method> (..can_read diff --git a/stdlib/source/lux/world/db/jdbc.lux b/stdlib/source/lux/world/db/jdbc.lux index 86865bd9b..3dba77a8e 100644 --- a/stdlib/source/lux/world/db/jdbc.lux +++ b/stdlib/source/lux/world/db/jdbc.lux @@ -75,7 +75,7 @@ (capability: #export (Can-Close !) (can-close Any (! (Try Any)))) -(signature: #export (DB !) +(interface: #export (DB !) (: (Can-Execute !) execute) (: (Can-Insert !) @@ -101,7 +101,7 @@ (def: #export (async db) (-> (DB IO) (DB Promise)) - (`` (structure + (`` (implementation (~~ (template [<name> <forge>] [(def: <name> (<forge> (|>> (!.use (\ db <name>)) promise.future)))] @@ -117,7 +117,7 @@ (get@ #user creds) (get@ #password creds))] (wrap (: (DB IO) - (structure + (implementation (def: execute (..can-execute (function (execute statement) diff --git a/stdlib/source/lux/world/db/jdbc/input.lux b/stdlib/source/lux/world/db/jdbc/input.lux index f1183ab75..19f9e7422 100644 --- a/stdlib/source/lux/world/db/jdbc/input.lux +++ b/stdlib/source/lux/world/db/jdbc/input.lux @@ -46,7 +46,7 @@ (-> a [Nat java/sql/PreparedStatement] (Try [Nat java/sql/PreparedStatement]))) -(structure: #export contravariant (Contravariant Input) +(implementation: #export contravariant (Contravariant Input) (def: (map-1 f fb) (function (fa value circumstance) (fb (f value) circumstance)))) diff --git a/stdlib/source/lux/world/db/jdbc/output.lux b/stdlib/source/lux/world/db/jdbc/output.lux index 66578ac8d..4639a5255 100644 --- a/stdlib/source/lux/world/db/jdbc/output.lux +++ b/stdlib/source/lux/world/db/jdbc/output.lux @@ -49,7 +49,9 @@ (type: #export (Output a) (-> [Nat java/sql/ResultSet] (Try [Nat a]))) -(structure: #export functor (Functor Output) +(implementation: #export functor + (Functor Output) + (def: (map f fa) (function (_ idx+rs) (case (fa idx+rs) @@ -59,7 +61,9 @@ (#try.Success [idx' value]) (#try.Success [idx' (f value)]))))) -(structure: #export apply (Apply Output) +(implementation: #export apply + (Apply Output) + (def: &functor ..functor) (def: (apply ff fa) @@ -76,7 +80,9 @@ (#try.Failure msg) (#try.Failure msg))))) -(structure: #export monad (Monad Output) +(implementation: #export monad + (Monad Output) + (def: &functor ..functor) (def: (wrap a) diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 670c1df6f..891d40530 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -53,7 +53,7 @@ (capability: #export (Can_Delete !) (can_delete [] (! (Try Any)))) -(`` (signature: #export (File !) +(`` (interface: #export (File !) (: (Can_See Path) path) @@ -83,7 +83,7 @@ delete) )) -(signature: #export (Directory !) +(interface: #export (Directory !) (: (Can_See Path) scope) @@ -96,7 +96,7 @@ (: (Can_Delete !) discard)) -(`` (signature: #export (System !) +(`` (interface: #export (System !) (~~ (template [<name> <capability>] [(: (Can_Open ! <capability>) <name>)] @@ -121,7 +121,7 @@ (def: (async_file file) (-> (File IO) (File Promise)) - (`` (structure + (`` (implementation (def: path (..can_see (|>> (!.use (\ file path))))) @@ -150,26 +150,27 @@ (def: (async_directory directory) (-> (Directory IO) (Directory Promise)) - (`` (structure (def: scope - (\ directory scope)) + (`` (implementation + (def: scope + (\ directory scope)) - (~~ (template [<name> <async>] - [(def: <name> - (..can_query - (|>> (!.use (\ directory <name>)) - (io\map (try\map (list\map <async>))) - promise.future)))] + (~~ (template [<name> <async>] + [(def: <name> + (..can_query + (|>> (!.use (\ directory <name>)) + (io\map (try\map (list\map <async>))) + promise.future)))] - [files ..async_file] - [directories async_directory])) + [files ..async_file] + [directories async_directory])) - (def: discard - (..can_delete - (|>> (!.use (\ directory discard)) promise.future)))))) + (def: discard + (..can_delete + (|>> (!.use (\ directory discard)) promise.future)))))) (def: #export (async system) (-> (System IO) (System Promise)) - (`` (structure + (`` (implementation (~~ (template [<name> <async>] [(def: <name> (..can_open (|>> (!.use (\ system <name>)) (io\map (try\map <async>)) promise.future)))] @@ -280,7 +281,7 @@ ["#::." (new [java/io/File] #io #try)]) - (`` (structure: (file path) + (`` (implementation: (file path) (-> Path (File IO)) (~~ (template [<name> <flag>] @@ -370,7 +371,7 @@ (function (delete _) (!delete path cannot_delete_file)))))) - (`` (structure: (directory path) + (`` (implementation: (directory path) (-> Path (Directory IO)) (def: scope @@ -404,7 +405,7 @@ (function (discard _) (!delete path cannot_discard_directory)))))) - (`` (structure: #export default + (`` (implementation: #export default (System IO) (~~ (template [<name> <method> <capability> <exception>] @@ -502,7 +503,7 @@ [node_path "path" ..JsPath] ) - (`` (structure: (file path) + (`` (implementation: (file path) (-> Path (File IO)) (~~ (template [<name> <method>] @@ -578,7 +579,7 @@ (function (delete _) (Fs::unlink [path] (..node_fs []))))))) - (`` (structure: (directory path) + (`` (implementation: (directory path) (-> Path (Directory IO)) (def: scope @@ -612,7 +613,7 @@ (function (discard _) (Fs::rmdirSync [path] (..node_fs []))))))) - (`` (structure: #export default + (`` (implementation: #export default (System IO) (~~ (template [<name> <method> <capability> <exception>] @@ -705,7 +706,7 @@ (#static getsize [ffi.String] #io #try ffi.Integer) (#static getmtime [ffi.String] #io #try ffi.Float)]) - (`` (structure: (file path) + (`` (implementation: (file path) (-> Path (File IO)) (~~ (template [<name> <mode>] @@ -778,7 +779,7 @@ (os::remove [path])))) )) - (`` (structure: (directory path) + (`` (implementation: (directory path) (-> Path (Directory IO)) (def: scope @@ -811,7 +812,7 @@ (os::rmdir [path])))) )) - (`` (structure: #export default + (`` (implementation: #export default (System IO) (~~ (template [<name> <method> <capability> <exception>] @@ -905,7 +906,7 @@ ["Signature" (%.name signature)] ["Operation" (%.text operation)])) - (`` (structure: (file path) + (`` (implementation: (file path) (-> Path (File IO)) (~~ (template [<name> <mode>] @@ -1007,7 +1008,7 @@ (exception.throw ..cannot_delete_file path))))))) )) - (`` (structure: (directory path) + (`` (implementation: (directory path) (-> Path (Directory IO)) (def: scope @@ -1078,7 +1079,7 @@ (#try.Success file) (wrap (exception.throw ..file_already_exists [path]))))) - (`` (structure: #export default + (`` (implementation: #export default (System IO) (def: file (..can_open ..default_file)) @@ -1163,7 +1164,7 @@ Text (..RubyFile::SEPARATOR)) - (`` (structure: (file path) + (`` (implementation: (file path) (-> Path (File IO)) (~~ (template [<name> <mode>] @@ -1242,7 +1243,7 @@ (wrap []))))) )) - (`` (structure: (directory path) + (`` (implementation: (directory path) (-> Path (Directory IO)) (def: scope @@ -1287,7 +1288,7 @@ (wrap []))))) )) - (`` (structure: #export default + (`` (implementation: #export default (System IO) (~~ (template [<name> <test> <constructor> <exception>] @@ -1365,7 +1366,7 @@ [cannot_write_to_file] ) - (`` (structure: (file path) + (`` (implementation: (file path) (-> Path (File IO)) (~~ (template [<name> <mode>] @@ -1443,7 +1444,7 @@ (wrap [])))))) )) - (`` (structure: (directory path) + (`` (implementation: (directory path) (-> Path (Directory IO)) (def: scope @@ -1489,7 +1490,7 @@ (wrap [])))))) )) - (`` (structure: #export default + (`` (implementation: #export default (System IO) (~~ (template [<name> <test> <constructor> <exception>] @@ -1717,7 +1718,7 @@ (def: (mock_file separator path store) (-> Text Path (Var Mock) (File Promise)) - (structure + (implementation (def: path (..can_see (function.constant path))) @@ -1905,7 +1906,7 @@ (def: (mock_directory separator path store) (-> Text Path (Var Mock) (Directory Promise)) - (structure + (implementation (def: scope (..can_see (function (_ _) @@ -1970,7 +1971,7 @@ (def: #export (mock separator) (-> Text (System Promise)) (let [store (stm.var ..empty_mock)] - (structure + (implementation (def: separator separator) (def: file diff --git a/stdlib/source/lux/world/file/watch.lux b/stdlib/source/lux/world/file/watch.lux index 0a826717f..24d8657ad 100644 --- a/stdlib/source/lux/world/file/watch.lux +++ b/stdlib/source/lux/world/file/watch.lux @@ -81,7 +81,7 @@ )) ) -(signature: #export (Watcher !) +(interface: #export (Watcher !) (: (-> Concern //.Path (! (Try Any))) start) (: (-> //.Path (! (Try Concern))) @@ -188,7 +188,7 @@ (-> (//.System Promise) (Watcher Promise)) (let [tracker (: (Var Directory_Tracker) (stm.var (dictionary.new text.hash)))] - (structure + (implementation (def: (start new_concern path) (do {! promise.monad} [updated? (stm.commit (..update_watch! new_concern path tracker))] @@ -428,7 +428,7 @@ #.None (wrap (exception.throw ..not_being_watched [path]))))))]] (wrap (: (Watcher Promise) - (structure + (implementation (def: (start concern path) (do promise.monad [?concern (stop path)] diff --git a/stdlib/source/lux/world/net/http.lux b/stdlib/source/lux/world/net/http.lux index 4a98fa492..6682c24bd 100644 --- a/stdlib/source/lux/world/net/http.lux +++ b/stdlib/source/lux/world/net/http.lux @@ -4,11 +4,10 @@ [try (#+ Try)] [concurrency [promise (#+ Promise)] - [frp (#+ Channel)]]] + [frp (#+ Channel)]] + [parser + ["." environment (#+ Environment)]]] [data - [format - [context (#+ Context)]]] - [world [binary (#+ Binary)]]] [// (#+ URL) [uri (#+ URI)]]) @@ -33,14 +32,18 @@ (type: #export Status Nat) -(type: #export Header - (-> Context Context)) +(type: #export Headers + Environment) + +(def: #export empty + Headers + environment.empty) -(type: #export Data - Binary) +(type: #export Header + (-> Headers Headers)) -(type: #export Body - (Channel Data)) +(type: #export (Body !) + (-> (Maybe Nat) (! (Try [Nat Binary])))) (type: #export Scheme #HTTP @@ -62,18 +65,15 @@ {#method Method #uri URI}) -(type: #export Message - {#headers Context - #body Body}) - -(type: #export Request - [Identification Protocol Resource Message]) +(type: #export (Message !) + {#headers Headers + #body (Body !)}) -(type: #export Response - [Status Message]) +(type: #export (Request !) + [Identification Protocol Resource (Message !)]) -(type: #export Server - (-> Request (Promise Response))) +(type: #export (Response !) + [Status (Message !)]) -(type: #export Client - (-> [Method URL Context Data] (Promise (Try Response)))) +(type: #export (Server !) + (-> (Request !) (! (Response !)))) diff --git a/stdlib/source/lux/world/net/http/client.lux b/stdlib/source/lux/world/net/http/client.lux new file mode 100644 index 000000000..145133288 --- /dev/null +++ b/stdlib/source/lux/world/net/http/client.lux @@ -0,0 +1,220 @@ +(.module: + [lux #* + ["@" target] + ["." ffi] + [abstract + ["." monad (#+ do)]] + [control + [pipe (#+ case>)] + ["." io (#+ IO)] + ["." try (#+ Try)] + [concurrency + ["." promise (#+ Promise)]]] + [data + ["." binary (#+ Binary)] + ["." maybe ("#\." functor)] + [collection + ["." dictionary]]] + [math + [number + ["n" nat] + ["i" int]]]] + ["." // + [// (#+ URL)]]) + +(interface: #export (Client !) + (: (-> //.Method URL //.Headers (Maybe Binary) + (! (Try (//.Response !)))) + request)) + +(template [<name> <method>] + [(def: #export (<name> url headers data client) + (All [!] + (-> URL //.Headers (Maybe Binary) (Client !) + (! (Try (//.Response !))))) + (\ client request <method> url headers data))] + + [post #//.Post] + [get #//.Get] + [put #//.Put] + [patch #//.Patch] + [delete #//.Delete] + [head #//.Head] + [connect #//.Connect] + [options #//.Options] + [trace #//.Trace] + ) + +(def: default_buffer_size + (n.* 1,024 1,024)) + +(def: empty_body + [Nat Binary] + [0 (binary.create 0)]) + +(def: (body_of data) + (-> Binary [Nat Binary]) + [(binary.size data) data]) + +(with_expansions [<jvm> (as_is (ffi.import: java/lang/String) + + (ffi.import: java/lang/AutoCloseable + ["#::." + (close [] #io #try void)]) + + (ffi.import: java/io/InputStream) + + (ffi.import: java/io/OutputStream + ["#::." + (flush [] #io #try void) + (write [[byte]] #io #try void)]) + + (ffi.import: java/net/URLConnection + ["#::." + (setDoOutput [boolean] #io #try void) + (setRequestProperty [java/lang/String java/lang/String] #io #try void) + (getInputStream [] #io #try java/io/InputStream) + (getOutputStream [] #io #try java/io/OutputStream) + (getHeaderFieldKey [int] #io #try #? java/lang/String) + (getHeaderField [int] #io #try #? java/lang/String)]) + + (ffi.import: java/net/HttpURLConnection + ["#::." + (setRequestMethod [java/lang/String] #io #try void) + (getResponseCode [] #io #try int)]) + + (ffi.import: java/net/URL + ["#::." + (new [java/lang/String]) + (openConnection [] #io #try java/net/URLConnection)]) + + (ffi.import: java/io/BufferedInputStream + ["#::." + (new [java/io/InputStream]) + (read [[byte] int int] #io #try int)]) + + (def: jvm_method + (-> //.Method Text) + (|>> (case> #//.Post "POST" + #//.Get "GET" + #//.Put "PUT" + #//.Patch "PATCH" + #//.Delete "DELETE" + #//.Head "HEAD" + #//.Connect "CONNECT" + #//.Options "OPTIONS" + #//.Trace "TRACE"))) + + (def: (default_body input) + (-> java/io/BufferedInputStream (//.Body IO)) + (|>> (maybe\map (|>> [true])) + (maybe.default [false ..default_buffer_size]) + (case> [_ 0] + (do (try.with io.monad) + [_ (java/lang/AutoCloseable::close input)] + (wrap ..empty_body)) + + [partial? buffer_size] + (let [buffer (binary.create buffer_size)] + (if partial? + (loop [so_far +0] + (do {! (try.with io.monad)} + [#let [remaining (i.- so_far (.int buffer_size))] + bytes_read (java/io/BufferedInputStream::read buffer so_far remaining input)] + (case bytes_read + -1 (do ! + [_ (java/lang/AutoCloseable::close input)] + (wrap [(.nat so_far) buffer])) + +0 (recur so_far) + _ (if (i.= remaining bytes_read) + (wrap [buffer_size buffer]) + (recur (i.+ bytes_read so_far)))))) + (loop [so_far +0 + output (\ binary.monoid identity)] + (do {! (try.with io.monad)} + [#let [remaining (i.- so_far (.int buffer_size))] + bytes_read (java/io/BufferedInputStream::read buffer so_far remaining input)] + (case bytes_read + -1 (do ! + [_ (java/lang/AutoCloseable::close input)] + (case so_far + +0 (wrap (..body_of output)) + _ (|> buffer + (binary.slice 0 (.nat so_far)) + (\ try.functor map + (|>> (\ binary.monoid compose output) + ..body_of)) + (\ io.monad wrap)))) + +0 (recur so_far output) + _ (if (i.= remaining bytes_read) + (recur +0 + (\ binary.monoid compose output buffer)) + (recur (i.+ bytes_read so_far) + output)))))))))) + + (def: (default_headers connection) + (-> java/net/HttpURLConnection (IO (Try //.Headers))) + (loop [index +0 + headers //.empty] + (do {! (try.with io.monad)} + [?name (java/net/URLConnection::getHeaderFieldKey index connection)] + (case ?name + (#.Some name) + (do ! + [?value (java/net/URLConnection::getHeaderField index connection)] + (recur (inc index) + (dictionary.put name (maybe.default "" ?value) headers))) + + #.None + (wrap headers))))) + + (implementation: #export default + (Client IO) + + (def: (request method url headers data) + (: (IO (Try (//.Response IO))) + (do {! (try.with io.monad)} + [connection (|> url java/net/URL::new java/net/URL::openConnection) + #let [connection (:coerce java/net/HttpURLConnection connection)] + _ (java/net/HttpURLConnection::setRequestMethod (..jvm_method method) connection) + _ (monad.map ! (function (_ [name value]) + (java/net/URLConnection::setRequestProperty name value connection)) + (dictionary.entries headers)) + _ (case data + (#.Some data) + (do ! + [_ (java/net/URLConnection::setDoOutput true connection) + stream (java/net/URLConnection::getOutputStream connection) + _ (java/io/OutputStream::write data stream) + _ (java/io/OutputStream::flush stream) + _ (java/lang/AutoCloseable::close stream)] + (wrap [])) + + #.None + (wrap [])) + status (java/net/HttpURLConnection::getResponseCode connection) + headers (..default_headers connection) + input (|> connection + java/net/URLConnection::getInputStream + (\ ! map (|>> java/io/BufferedInputStream::new)))] + (wrap [(.nat status) + {#//.headers headers + #//.body (..default_body input)}]))))))] + (for {@.old (as_is <jvm>) + @.jvm (as_is <jvm>)})) + +(implementation: #export (async client) + (-> (Client IO) (Client Promise)) + + (def: (request method url headers data) + (|> (\ client request method url headers data) + promise.future + (\ promise.monad map + (|>> (case> (#try.Success [status message]) + (#try.Success [status (update@ #//.body (: (-> (//.Body IO) (//.Body Promise)) + (function (_ body) + (|>> body promise.future))) + message)]) + + (#try.Failure error) + (#try.Failure error))))))) diff --git a/stdlib/source/lux/world/program.lux b/stdlib/source/lux/world/program.lux index 96019a132..7b15dcbbc 100644 --- a/stdlib/source/lux/world/program.lux +++ b/stdlib/source/lux/world/program.lux @@ -38,7 +38,7 @@ (exception.report ["Name" (%.text name)])) -(signature: #export (Program !) +(interface: #export (Program !) (: (-> Any (! (List Text))) available_variables) (: (-> Text (! (Try Text))) @@ -67,7 +67,7 @@ #.None))) (dictionary.from_list text.hash))))) -(`` (structure: #export (async program) +(`` (implementation: #export (async program) (-> (Program IO) (Program Promise)) (~~ (template [<method>] @@ -84,7 +84,7 @@ (def: #export (mock environment home directory) (-> Environment Path Path (Program IO)) (let [@dead? (atom.atom false)] - (structure + (implementation (def: available_variables (function.constant (io.io (dictionary.keys environment)))) (def: (variable name) @@ -275,7 +275,7 @@ } (as_is))) -(structure: #export default +(implementation: #export default (Program IO) (def: (available_variables _) diff --git a/stdlib/source/lux/world/service/journal.lux b/stdlib/source/lux/world/service/journal.lux index 22ff08010..f05195c4f 100644 --- a/stdlib/source/lux/world/service/journal.lux +++ b/stdlib/source/lux/world/service/journal.lux @@ -24,12 +24,12 @@ (def: #export (range start end) (-> Instant Instant Range) - (structure + (implementation (def: &enum instant.enum) (def: bottom start) (def: top end))) -(structure: #export (equivalence (^open "_\.")) +(implementation: #export (equivalence (^open "_\.")) (All [a] (-> (Equivalence a) (Equivalence (Entry a)))) (def: (= reference sample) (and (_\= (get@ #what reference) (get@ #what sample)) diff --git a/stdlib/source/lux/world/shell.lux b/stdlib/source/lux/world/shell.lux index b1556d35c..0691958b8 100644 --- a/stdlib/source/lux/world/shell.lux +++ b/stdlib/source/lux/world/shell.lux @@ -57,7 +57,7 @@ (capability: #export (Can_Wait !) (can_wait [] (! (Try Exit)))) -(signature: #export (Process !) +(interface: #export (Process !) (: (Can_Read !) read) (: (Can_Read !) @@ -71,7 +71,7 @@ (def: (async_process process) (-> (Process IO) (Process Promise)) - (`` (structure + (`` (implementation (~~ (template [<method> <capability>] [(def: <method> (<capability> @@ -94,13 +94,13 @@ (capability: #export (Can_Execute !) (can_execute [Environment Path Command (List Argument)] (! (Try (Process !))))) -(signature: #export (Shell !) +(interface: #export (Shell !) (: (Can_Execute !) execute)) (def: #export (async shell) (-> (Shell IO) (Shell Promise)) - (structure + (implementation (def: execute (..can_execute (function (_ input) @@ -110,7 +110,7 @@ (wrap (..async_process process))))))))) ## https://en.wikipedia.org/wiki/Code_injection#Shell_injection -(signature: (Policy ?) +(interface: (Policy ?) (: (-> Command (Safe Command ?)) command) (: (-> Argument (Safe Argument ?)) @@ -156,7 +156,7 @@ (?.with_policy (: (Context Safety Policy) (function (_ (^open "?\.")) - (structure + (implementation (def: command (|>> sanitize_command (!.use ?\can_upgrade))) (def: argument (|>> sanitize_argument (!.use ?\can_upgrade))) (def: value (!.use ?\can_downgrade))))))) @@ -257,7 +257,7 @@ java/io/InputStreamReader::new java/io/BufferedReader::new)]] (wrap (: (Process IO) - (`` (structure + (`` (implementation (~~ (template [<name> <stream>] [(def: <name> (..can_read @@ -310,7 +310,7 @@ (|>> java/lang/String::toLowerCase (text.starts_with? "windows")) (java/lang/System::getProperty "os.name"))) - (structure: #export default + (implementation: #export default (Shell IO) (def: execute @@ -332,7 +332,7 @@ @.jvm (as_is <jvm>)} (as_is))) -(signature: #export (Simulation s) +(interface: #export (Simulation s) (: (-> s (Try [s Text])) on_read) (: (-> s (Try [s Text])) @@ -344,7 +344,7 @@ (: (-> s (Try [s Exit])) on_await)) -(`` (structure: (mock_process simulation state) +(`` (implementation: (mock_process simulation state) (All [s] (-> (Simulation s) (Atom s) (Process IO))) (~~ (template [<name> <capability> <simulation>] @@ -393,7 +393,7 @@ (#try.Failure error) (wrap (#try.Failure error))))))))) -(structure: #export (mock simulation init) +(implementation: #export (mock simulation init) (All [s] (-> (-> [Environment Path Command (List Argument)] (Try (Simulation s))) diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux index 66ea54f50..1ef5c4137 100644 --- a/stdlib/source/poly/lux/abstract/functor.lux +++ b/stdlib/source/poly/lux/abstract/functor.lux @@ -104,5 +104,6 @@ (Arg<?> inputC)) (p.fail (format "Cannot create Functor for: " (%.type inputT)))))] (wrap (` (: (~ (@Functor inputT)) - (structure (def: ((~' map) (~ funcC) (~ inputC)) - (~ outputC)))))))) + (implementation + (def: ((~' map) (~ funcC) (~ inputC)) + (~ outputC)))))))) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index 1efbf39a8..cf3076f72 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -56,7 +56,7 @@ (def: low_mask Nat (|> 1 (i64.left_shift 32) dec)) (def: high_mask Nat (|> low_mask (i64.left_shift 32))) -(structure: nat_codec +(implementation: nat_codec (codec.Codec JSON Nat) (def: (encode input) @@ -72,7 +72,7 @@ (wrap (n.+ (|> high frac.int .nat (i64.left_shift 32)) (|> low frac.int .nat)))))))) -(structure: int_codec +(implementation: int_codec (codec.Codec JSON Int) (def: encode (|>> .nat (\ nat_codec encode))) @@ -87,7 +87,7 @@ #.None #/.Null (#.Some value) (writer value)))) -(structure: qty_codec +(implementation: qty_codec (All [unit] (codec.Codec JSON (unit.Qty unit))) @@ -343,8 +343,9 @@ (derived: (..codec Record)))} (wrap (list (` (: (codec.Codec /.JSON (~ inputT)) - (structure (def: (~' encode) - ((~! ..encode) (~ inputT))) - (def: (~' decode) - ((~! </>.run) ((~! ..decode) (~ inputT)))) - )))))) + (implementation + (def: (~' encode) + ((~! ..encode) (~ inputT))) + (def: (~' decode) + ((~! </>.run) ((~! ..decode) (~ inputT)))) + )))))) diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux index 0488d76dd..836365fed 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot.lux @@ -18,7 +18,7 @@ #Local (#Remote Stamp)) -(structure: any_equivalence +(implementation: any_equivalence (Equivalence Any) (def: (= _ _) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 989abb5fc..655b8f6c2 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -56,7 +56,7 @@ (-> Date date.Date) (|>> :representation)) - (structure: #export equivalence + (implementation: #export equivalence (Equivalence Date) (def: (= reference subject) diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index f2f502bac..0c943efc9 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -18,7 +18,7 @@ #Build #Test) -(structure: any_equivalence +(implementation: any_equivalence (Equivalence Any) (def: (= reference subject) diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index ecb71b59d..b966fe85e 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -4,6 +4,7 @@ ["." monad (#+ do)]] [control ["." try (#+ Try)] + ["." exception] [security ["!" capability]] [concurrency @@ -35,15 +36,23 @@ (def: #export (do! console fs profile) (-> (Console Promise) (file.System Promise) (Command Any)) - (do {! ///action.monad} + (do promise.monad [#let [target (get@ #///.target profile)] root (: (Promise (Try (Directory Promise))) - (!.use (\ fs directory) target)) - _ (loop [root root] - (do ! - [_ (..clean_files! root) - subs (: (Promise (Try (List (Directory Promise)))) - (!.use (\ root directories) [])) - _ (monad.map ! recur subs)] - (!.use (\ root discard) [])))] - (console.write_line (..success target) console))) + (!.use (\ fs directory) target))] + (case root + (#try.Success root) + (do {! ///action.monad} + [_ (loop [root root] + (do ! + [_ (..clean_files! root) + subs (: (Promise (Try (List (Directory Promise)))) + (!.use (\ root directories) [])) + _ (monad.map ! recur subs)] + (!.use (\ root discard) [])))] + (console.write_line (..success target) console)) + + (#try.Failure error) + (if (exception.match? file.cannot_find_directory error) + (console.write_line (..success target) console) + (\ promise.monad wrap (#try.Failure error)))))) diff --git a/stdlib/source/program/aedifex/dependency/status.lux b/stdlib/source/program/aedifex/dependency/status.lux index 82d99e9aa..8c4db9ddd 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -15,7 +15,7 @@ (Hash MD5))) (#Verified (Hash SHA-1) (Hash MD5))) -(structure: any_equivalence +(implementation: any_equivalence (Equivalence Any) (def: (= _ _) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index b94e2a0cf..2e0e35db0 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -145,7 +145,7 @@ (exception.throw ..not_a_hash [(..encoding_size size) encoded])))) (template [<codec> <hash> <nat> <constructor>] - [(structure: #export <codec> + [(implementation: #export <codec> (Codec Text (Hash <hash>)) (def: encode (|>> :representation ..encode)) @@ -155,7 +155,7 @@ [md5_codec MD5 ..md5::size ..as_md5] ) - (structure: #export equivalence + (implementation: #export equivalence (All [h] (Equivalence (Hash h))) (def: (= reference subject) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 98eb1c43e..eb686cc15 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -31,7 +31,7 @@ #Repo #Manual) -(structure: distribution_equivalence +(implementation: distribution_equivalence (Equivalence Distribution) (def: (= reference subject) @@ -179,7 +179,7 @@ ## #deploy_repositories (dictionary.equivalence text.equivalence))) -(structure: #export monoid +(implementation: #export monoid (Monoid Profile) (def: identity diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 5dce87e0a..a35a3651c 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -31,7 +31,7 @@ (Equivalence Project) (dictionary.equivalence //.equivalence)) -(structure: #export monoid +(implementation: #export monoid (Monoid Project) (def: identity diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index 230888cef..c5f822633 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -14,7 +14,7 @@ [net [uri (#+ URI)]]]]) -(signature: #export (Repository !) +(interface: #export (Repository !) (: (-> URI (! (Try Binary))) download) (: (-> URI Binary (! (Try Any))) @@ -22,7 +22,7 @@ (def: #export (async repository) (-> (Repository IO) (Repository Promise)) - (structure + (implementation (def: (download uri) (promise.future (\ repository download uri))) @@ -30,7 +30,7 @@ (promise.future (\ repository upload uri content))) )) -(signature: #export (Simulation s) +(interface: #export (Simulation s) (: (-> URI s (Try [s Binary])) on_download) (: (-> URI Binary s (Try s)) @@ -39,7 +39,7 @@ (def: #export (mock simulation init) (All [s] (-> (Simulation s) s (Repository Promise))) (let [state (stm.var init)] - (structure + (implementation (def: (download uri) (stm.commit (do {! stm.monad} diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index d026559c9..2841bbd32 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -48,7 +48,7 @@ (: (Promise (Try (File Promise))) (!.use (\ system file) absolute_path))))) -(structure: #export (repository program system) +(implementation: #export (repository program system) (-> (Program Promise) (file.System Promise) (//.Repository Promise)) (def: (download uri) diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index eb285bb67..dcf1e1d51 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -80,12 +80,12 @@ (format (///artifact.uri version_template artifact) extension)) (def: buffer_size - (n.* 512 1,024)) + (n.* 1,024 1,024)) (def: user_agent (format "LuxAedifex/" (version.format language/lux.version))) -(structure: #export (repository identity address) +(implementation: #export (repository identity address) (All [s] (-> (Maybe Identity) Address (//.Repository IO))) (def: (download uri) @@ -99,21 +99,20 @@ input (|> connection java/net/URLConnection::getInputStream (\ ! map (|>> java/io/BufferedInputStream::new))) - #let [buffer (binary.create ..buffer_size)] - output (loop [output (\ binary.monoid identity)] + #let [buffer (binary.create ..buffer_size)]] + (loop [output (\ binary.monoid identity)] + (do ! + [bytes_read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer_size) input)] + (case bytes_read + -1 (do ! + [_ (java/lang/AutoCloseable::close input)] + (wrap output)) + +0 (recur output) + _ (if (n.= ..buffer_size bytes_read) + (recur (\ binary.monoid compose output buffer)) (do ! - [bytes_read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer_size) input)] - (case bytes_read - -1 (do ! - [_ (java/lang/AutoCloseable::close input)] - (wrap output)) - +0 (recur output) - _ (if (n.= ..buffer_size bytes_read) - (recur (\ binary.monoid compose output buffer)) - (do ! - [chunk (\ io.monad wrap (binary.slice 0 (.nat bytes_read) buffer))] - (recur (\ binary.monoid compose output chunk)))))))] - (wrap output))) + [chunk (\ io.monad wrap (binary.slice 0 (.nat bytes_read) buffer))] + (recur (\ binary.monoid compose output chunk))))))))) (def: (upload uri content) (case identity diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index 2a205287a..a32a14f8f 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -267,7 +267,7 @@ (type: Organization {#types (List Value) #macros (List [Text Code]) - #structures (List Value) + #implementations (List Value) #values (List Value)}) (def: (lux-module? module-name) @@ -289,8 +289,8 @@ (|>> (#.Cons [name def-annotations]))) organization) - (macro.structure? def-annotations) - (update@ #structures + (macro.implementation? def-annotations) + (update@ #implementations (: (Mutation (List Value)) (|>> (#.Cons [name def-annotations def-type]))) organization) @@ -311,12 +311,12 @@ (-> (List [Text Definition]) Organization) (let [init {#types (list) #macros (list) - #structures (list) + #implementations (list) #values (list)}] (|> (list\fold add-definition init defs) (update@ #types (list.sort name-sort)) (update@ #macros (list.sort name-sort)) - (update@ #structures (list.sort name-sort)) + (update@ #implementations (list.sort name-sort)) (update@ #values (list.sort name-sort))))) (def: (unravel-type-func level type) @@ -359,7 +359,7 @@ _ (format "(" (text.join-with " " (list& _name type-arguments)) ")")) nesting (list.size type-arguments)]] - (wrap (md.code (format (if signature? "(signature: " "(type: ") + (wrap (md.code (format (if signature? "(interface: " "(type: ") (if recursive-type? "#rec " "") usage text.new-line (|> type @@ -440,7 +440,7 @@ (list\fold (function.flip md.then) (md.heading/2 <header>))))] - [document-structure document-structures "Structures"] + [document-implementation document-implementations "Implementations"] [document-value document-values "Values"] ) @@ -454,7 +454,7 @@ (def: (document-module [[module-name module] organization]) (-> [[Text Module] Organization] (Meta [Text (Markdown Block)])) (do macro.monad - [#let [(^slots [#types #macros #structures #values]) organization + [#let [(^slots [#types #macros #implementations #values]) organization annotations (|> module (get@ #.module-annotations) (maybe.default (' {})) @@ -472,7 +472,7 @@ #let [documentation ($_ md.then types-documentation (if (list.empty? macros) empty-block (document-macros module-name macros)) - (if (list.empty? structures) empty-block (document-structures module-name structures)) + (if (list.empty? implementations) empty-block (document-implementations module-name implementations)) (if (list.empty? values) empty-block (document-values module-name values)))]] (wrap [module-name ($_ md.then diff --git a/stdlib/source/spec/aedifex/repository.lux b/stdlib/source/spec/aedifex/repository.lux index 1688f1e03..675d055b0 100644 --- a/stdlib/source/spec/aedifex/repository.lux +++ b/stdlib/source/spec/aedifex/repository.lux @@ -29,24 +29,29 @@ [expected (_binary.random 100)] (wrap ($_ _.and' (do promise.monad - [#let [uri/good (/remote.uri (get@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)] - upload!/good (\ subject upload uri/good expected) - download!/good (\ subject download uri/good) + [#let [good_uri (/remote.uri (get@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)] + good_upload! (\ subject upload good_uri expected) + good_download! (\ subject download good_uri) - #let [uri/bad (/remote.uri (get@ #//artifact.version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] - upload!/bad (\ subject upload uri/bad expected) - download!/bad (\ subject download uri/bad)] + #let [bad_uri (/remote.uri (get@ #//artifact.version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] + bad_upload! (\ subject upload bad_uri expected) + bad_download! (\ subject download bad_uri)] (_.cover' [/.Repository] - (and (case [upload!/good download!/good] - [(#try.Success _) (#try.Success actual)] - (\ binary.equivalence = expected actual) + (let [successfull_flow! + (case [good_upload! good_download!] + [(#try.Success _) (#try.Success actual)] + (\ binary.equivalence = expected actual) - _ - false) - (case [upload!/bad download!/bad] - [(#try.Failure _) (#try.Failure _)] - true - - _ - false)))) + _ + false) + + failed_flow! + (case [bad_upload! bad_download!] + [(#try.Failure _) (#try.Failure _)] + true + + _ + false)] + (and successfull_flow! + failed_flow!)))) )))) diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index 477ae4d50..e3c2bd1eb 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -20,9 +20,8 @@ ["#." pom] ["#." profile] ["#." project] - ## ["#." repository] - ## ["#." runtime] - ]) + ["#." repository] + ["#." runtime]]) (def: dependency Test @@ -48,9 +47,8 @@ /pom.test /profile.test /project.test - - ## /repository.test - ## /runtime.test + /repository.test + /runtime.test )) (program: args diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 7fd8c3eb3..0e86ef946 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -43,7 +43,7 @@ (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Simulation []) - (structure + (implementation (def: (on_read state) (exception.throw shell.no_more_output [])) (def: (on_error state) @@ -61,7 +61,7 @@ (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Simulation []) - (structure + (implementation (def: (on_read state) (exception.throw shell.no_more_output [])) (def: (on_error state) diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index 291b31863..cad06aa69 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -84,7 +84,7 @@ (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Simulation []) - (structure + (implementation (def: (on_read state) (exception.throw shell.no_more_output [])) (def: (on_error state) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index c7a9aa4ef..079b0fde4 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -31,7 +31,7 @@ (exception: #export console_is_closed!) -(structure: simulation +(implementation: simulation (Simulation [Bit Text]) (def: (on_read [open? state]) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index ae8c7699b..ebb32b790 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -59,7 +59,7 @@ (def: #export (single artifact package) (-> Artifact Package (Simulation Any)) (let [expected (///artifact.uri (get@ #///artifact.version artifact) artifact)] - (structure + (implementation (def: (on_download uri state) (if (text.contains? expected uri) (cond (text.ends_with? ///artifact/extension.lux_library uri) @@ -122,7 +122,7 @@ (def: (bad_sha-1 expected_artifact expected_package dummy_package) (-> Artifact Package Package (Simulation Any)) - (structure + (implementation (def: (on_download uri state) (if (text.contains? (///artifact.uri (get@ #///artifact.version expected_artifact) expected_artifact) uri) (cond (text.ends_with? ///artifact/extension.lux_library uri) @@ -173,7 +173,7 @@ (def: (bad_md5 expected_artifact expected_package dummy_package) (-> Artifact Package Package (Simulation Any)) - (structure + (implementation (def: (on_download uri state) (if (text.contains? (///artifact.uri (get@ #///artifact.version expected_artifact) expected_artifact) uri) (cond (text.ends_with? ///artifact/extension.lux_library uri) diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index df8db3e88..ed32f0ac3 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -30,6 +30,7 @@ ["$." /]} {#program ["." / + ["#." remote] ["/#" // #_ ["#." artifact (#+ Version Artifact) ["#/." extension (#+ Extension)]]]]}) @@ -42,6 +43,10 @@ (exception.report ["URI" (%.text uri)])) +(exception: (cannot_upload {uri URI}) + (exception.report + ["URI" (%.text uri)])) + (type: Store (Dictionary URI Binary)) @@ -49,27 +54,46 @@ Store (dictionary.new text.hash)) -(structure: #export simulation +(def: valid_version + Version + "1.2.3-YES") + +(def: invalid_version + Version + "4.5.6-NO") + +(implementation: #export simulation (/.Simulation Store) (def: (on_download uri state) (case (dictionary.get uri state) (#.Some content) - (exception.return [state content]) + (case (binary.size content) + 0 (exception.throw ..not_found [uri]) + _ (exception.return [state content])) #.None (exception.throw ..not_found [uri]))) (def: (on_upload uri content state) - (exception.return (dictionary.put uri content state)))) + (if (dictionary.key? state uri) + (exception.throw ..cannot_upload [uri]) + (exception.return (dictionary.put uri content state))))) (def: #export test Test (<| (_.covering /._) ($_ _.and (_.for [/.mock /.Simulation] - ($/.spec (..artifact "1.2.3-YES") - (..artifact "4.5.6-NO") - (/.mock ..simulation ..empty))) + (do random.monad + [_ (wrap [])] + ($/.spec (..artifact ..valid_version) + (..artifact ..invalid_version) + (/.mock ..simulation + (|> ..empty + (dictionary.put (/remote.uri ..invalid_version + (..artifact ..invalid_version) + //artifact/extension.lux_library) + (binary.create 0))))))) /identity.test /origin.test diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index 17b3428d2..0143eaac8 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -18,8 +18,9 @@ (`` ($_ _.and (~~ (template [<command>] [(_.cover [<command>] - (let [command (<command> path)] - (and (text.starts_with? (<command> "") command) + (let [command (text.join_with " " (#.Cons (<command> path))) + pure_command (text.join_with " " (#.Cons (<command> "")))] + (and (text.starts_with? pure_command command) (text.ends_with? path command))))] [/.java] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index b2929de58..bc7231470 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -37,6 +37,7 @@ ["#." math] ["#." meta] ["#." program] + ["#." target] ["#." time] ## ["#." tool] ## TODO: Update & expand tests for this ["#." type] @@ -222,6 +223,7 @@ /math.test /meta.test /program.test + /target.test /time.test ## /tool.test /type.test diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux index 1bbbcf460..1ac81f9d2 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -19,7 +19,7 @@ (def: json (Codec JSON Bit) (let [field "value"] - (structure + (implementation (def: encode (|>> #json.Boolean [field] diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index cceb75c42..cc6da47eb 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -27,7 +27,7 @@ sample random.nat different (|> random.nat (random.filter (|>> (n.= sample) not))) #let [equivalence (: (Equivalence (Equivalence Nat)) - (structure + (implementation (def: (= left right) (and (bit\= (\ left = leftN leftN) (\ right = leftN leftN)) @@ -42,7 +42,7 @@ (_.cover [/.rec] (let [equivalence (: (Equivalence (List Nat)) (/.rec (function (_ equivalence) - (structure + (implementation (def: (= left right) (case [left right] [#.Nil #.Nil] diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux index c527fb9c9..d9ddadabe 100644 --- a/stdlib/source/test/lux/abstract/hash.lux +++ b/stdlib/source/test/lux/abstract/hash.lux @@ -24,7 +24,7 @@ [leftN random.nat rightN random.nat #let [hash (: (Equivalence (/.Hash Nat)) - (structure + (implementation (def: (= (^open "left\.") (^open "right\.")) (and (bit\= (left\= (left\hash leftN) (left\hash leftN)) (right\= (right\hash leftN) (right\hash leftN))) diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index e9121353a..495db63e8 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -25,7 +25,7 @@ [left random.nat right (|> random.nat (random.filter (|>> (n.= left) not))) #let [equivalence (: (Equivalence (/.Order Nat)) - (structure + (implementation (def: (= leftO rightO) (and (bit\= (\ leftO < left left) (\ rightO < left left)) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index be2953aba..cf8ee5ad5 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -35,7 +35,7 @@ [sample random.nat samples (random.list 10 random.nat) #let [equivalence (: (Equivalence (/.Predicate Nat)) - (structure + (implementation (def: (= left right) (bit\= (left sample) (right sample)))))]]) diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux index 354433cc8..f1730629c 100644 --- a/stdlib/source/test/lux/control/function.lux +++ b/stdlib/source/test/lux/control/function.lux @@ -32,7 +32,7 @@ (<| (_.covering /._) ($_ _.and (let [equivalence (: (Equivalence (-> Nat Nat)) - (structure + (implementation (def: (= left right) (n.= (left extra) (right extra))))) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 8ca196ba5..ed6ba8591 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -29,7 +29,7 @@ dummy random.nat shift (|> random.nat (random.filter (|>> (n.= dummy) not))) #let [equivalence (: (Equivalence (/.Mixin Nat Nat)) - (structure + (implementation (def: (= left right) (n.= ((/.mixin left) input) ((/.mixin right) input))))) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 943b8b3d5..5311ccdb3 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -70,7 +70,7 @@ (Random Name) (random.and ..random_text ..random_text)) -(structure: location_equivalence +(implementation: location_equivalence (Equivalence Location) (def: (= [expected_module expected_line expected_column] diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 9c72304d9..c4c0657e7 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -35,7 +35,7 @@ (type: Password (Private Text)) -(signature: (Policy %) +(interface: (Policy %) (: (Hash (Password %)) &hash) @@ -50,13 +50,14 @@ (/.with_policy (: (Context Privacy Policy) (function (_ (^@ privilege (^open "%\."))) - (structure + (implementation (def: &hash - (structure + (implementation (def: &equivalence - (structure (def: (= reference sample) - (text\= (!.use %\can_downgrade reference) - (!.use %\can_downgrade sample))))) + (implementation + (def: (= reference sample) + (text\= (!.use %\can_downgrade reference) + (!.use %\can_downgrade sample))))) (def: hash (|>> (!.use %\can_downgrade) (\ text.hash hash))))) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 92705210b..d4ba74ed7 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -54,7 +54,7 @@ (do ! [constant random.nat #let [hash (: (Hash Nat) - (structure + (implementation (def: &equivalence n.equivalence) (def: (hash _) constant)))]] diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 013936731..d10ee90cc 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -21,7 +21,7 @@ {1 ["." /]}) -(structure: (equivalence super) +(implementation: (equivalence super) (All [a] (-> (Equivalence a) (Equivalence (/.Sequence a)))) (def: (= reference subject) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 282749f5e..a0d7e446b 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -54,7 +54,7 @@ (do ! [hash (\ ! map (function (_ constant) (: (Hash Nat) - (structure + (implementation (def: &equivalence n.equivalence) (def: (hash _) diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index a8119145b..50b1c1fd6 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -21,10 +21,10 @@ ["f" frac] ["r" rev]]]] {1 - ["." / (#+ Color)]}) + ["." /]}) (def: #export random - (Random Color) + (Random /.Color) (|> ($_ random.and random.nat random.nat random.nat) (\ random.monad map /.from_rgb))) @@ -32,8 +32,13 @@ (-> Nat Frac) (|>> .int int.frac)) -(def: square (-> Frac Frac) (math.pow +2.0)) -(def: square_root (-> Frac Frac) (math.pow +0.5)) +(def: square + (-> Frac Frac) + (math.pow +2.0)) + +(def: square_root + (-> Frac Frac) + (math.pow +0.5)) (def: (distance/1 from to) (-> Frac Frac Frac) @@ -42,7 +47,7 @@ (f.- from to)))) (def: (distance/3 from to) - (-> Color Color Frac) + (-> /.Color /.Color Frac) (let [[fr fg fb] (/.to_rgb from) [tr tg tb] (/.to_rgb to)] (square_root @@ -55,7 +60,7 @@ (template [<field>] [(def: (<field> color) - (-> Color Frac) + (-> /.Color Frac) (let [[hue saturation luminance] (/.to_hsl color)] <field>))] diff --git a/stdlib/source/test/lux/data/format/binary.lux b/stdlib/source/test/lux/data/format/binary.lux index 6cc42d90d..c667c6070 100644 --- a/stdlib/source/test/lux/data/format/binary.lux +++ b/stdlib/source/test/lux/data/format/binary.lux @@ -14,7 +14,7 @@ {1 ["." /]}) -(structure: equivalence +(implementation: equivalence (Equivalence /.Specification) (def: (= reference subject) diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index 8b1e9a700..1f0c2c9e6 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -50,7 +50,7 @@ {1 ["." /]}) -(structure: (equivalence example) +(implementation: (equivalence example) (All [a] (-> a (Equivalence (/.Format a)))) (def: (= reference subject) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 9edaecd0c..d2686f3ba 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -12,34 +12,34 @@ ["i" int]]] ["_" test (#+ Test)]] {1 - ["." / (#+ import: class: interface: object)]}) + ["." /]}) -(import: (java/util/concurrent/Callable a)) +(/.import: (java/util/concurrent/Callable a)) -(import: java/lang/Long) +(/.import: java/lang/Long) -(import: java/lang/String) +(/.import: java/lang/String) -(import: java/lang/Exception +(/.import: java/lang/Exception ["#::." (new [java/lang/String])]) -(import: java/lang/Object) +(/.import: java/lang/Object) -(import: (java/lang/Class a) +(/.import: (java/lang/Class a) ["#::." (getName [] java/lang/String)]) -(import: java/lang/Runnable) +(/.import: java/lang/Runnable) -(import: java/lang/System +(/.import: java/lang/System ["#::." (#static out java/io/PrintStream) (#static currentTimeMillis [] #io long) (#static getenv [java/lang/String] #io #? java/lang/String)]) -## TODO: Handle "class:" ASAP. -## (class: #final (TestClass A) [java/lang/Runnable] +## TODO: Handle "/.class:" ASAP. +## (/.class: #final (TestClass A) [java/lang/Runnable] ## ## Fields ## (#private foo boolean) ## (#private bar A) @@ -58,20 +58,20 @@ ## [])) (def: test_runnable - (object [] [java/lang/Runnable] + (/.object [] [java/lang/Runnable] [] (java/lang/Runnable [] (run self) void []))) (def: test_callable - (object [a] [(java/util/concurrent/Callable a)] + (/.object [a] [(java/util/concurrent/Callable a)] [] ((java/util/concurrent/Callable a) [] (call self) a #throws [java/lang/Exception] (undefined)))) -## (interface: TestInterface +## (/.interface: TestInterface ## ([] foo [boolean java/lang/String] void #throws [java/lang/Exception])) (def: conversions diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index b14dac30d..37eb2c103 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -12,30 +12,30 @@ ["i" int]]] ["_" test (#+ Test)]] {1 - ["." / (#+ import: class: interface: object)]}) + ["." /]}) -(import: (java/util/concurrent/Callable a)) +(/.import: (java/util/concurrent/Callable a)) -(import: java/lang/Object) -(import: java/lang/String) +(/.import: java/lang/Object) +(/.import: java/lang/String) -(import: java/lang/Exception +(/.import: java/lang/Exception ["#::." (new [java/lang/String])]) -(import: java/lang/Runnable) +(/.import: java/lang/Runnable) -(import: (java/lang/Class a) +(/.import: (java/lang/Class a) ["#::." (getName [] java/lang/String)]) -(import: java/lang/System +(/.import: java/lang/System ["#::." (#static out java/io/PrintStream) (#static currentTimeMillis [] #io long) (#static getenv [java/lang/String] #io #? java/lang/String)]) -(class: #final (TestClass A) [java/lang/Runnable] +(/.class: #final (TestClass A) [java/lang/Runnable] ## Fields (#private foo boolean) (#private bar A) @@ -54,18 +54,18 @@ [])) (def: test_runnable - (object [] [java/lang/Runnable] + (/.object [] [java/lang/Runnable] [] (java/lang/Runnable [] (run self) void []))) (def: test_callable - (object [a] [(java/util/concurrent/Callable a)] + (/.object [a] [(java/util/concurrent/Callable a)] [] (java/util/concurrent/Callable [] (call self) a (undefined)))) -(interface: TestInterface +(/.interface: TestInterface ([] foo [boolean java/lang/String] void #throws [java/lang/Exception])) (def: conversions diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 58587ad95..bb2d7184c 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -340,7 +340,7 @@ [sample random.rev [_ fuzzy] ..gradient #let [equivalence (: (Equivalence (/.Fuzzy Rev)) - (structure + (implementation (def: (= left right) (r.= (left sample) (right sample)))))]] diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index 51b33a70b..01f410b92 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -112,7 +112,7 @@ (..annotation key) <definition>)))))] - [/.structure? #.struct?] + [/.implementation? #.implementation?] [/.recursive_type? #.type-rec?] [/.signature? #.sig?] )) diff --git a/stdlib/source/test/lux/target.lux b/stdlib/source/test/lux/target.lux new file mode 100644 index 000000000..6f6050e1c --- /dev/null +++ b/stdlib/source/test/lux/target.lux @@ -0,0 +1,45 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [data + ["." text] + [collection + ["." list] + ["." set (#+ Set)]]] + [math + [number + ["n" nat]]]] + {1 + ["." /]}) + +(with_expansions [<targets> (as_is /.old + /.js + /.jvm + /.lua + /.python + /.ruby + /.common_lisp + /.php + /.r + /.scheme)] + (def: all + (List /.Target) + (list <targets>)) + + (def: unique + (Set /.Target) + (set.from_list text.hash ..all)) + + (def: verdict + (n.= (list.size ..all) + (set.size ..unique))) + + (def: #export test + Test + (<| (_.covering /._) + (_.for [/.Target]) + ($_ _.and + (_.cover [<targets>] + ..verdict) + ))) + ) diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux index 62e0fc397..47e4ceb27 100644 --- a/stdlib/source/test/lux/world.lux +++ b/stdlib/source/test/lux/world.lux @@ -10,7 +10,10 @@ ["#/." keyboard]] ["#." output #_ ["#/." video #_ - ["#/." resolution]]]]) + ["#/." resolution]]] + ["#." net #_ + ["#/." http #_ + ["#/." client]]]]) (def: #export test Test @@ -21,4 +24,5 @@ /program.test /input/keyboard.test /output/video/resolution.test + /net/http/client.test )) diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index 6c71f913c..56e3902f0 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -23,7 +23,7 @@ (def: simulation (/.Simulation [Bit Text]) - (structure + (implementation (def: (on_read [dead? content]) (do try.monad [char (try.from_maybe (text.nth 0 content)) diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux new file mode 100644 index 000000000..0ac51bad0 --- /dev/null +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -0,0 +1,84 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + [pipe (#+ do>)] + ["." io (#+ IO)] + ["." try] + ["." function]] + [data + ["." binary] + ["." product] + [text + ["%" format (#+ format)] + [encoding + ["." utf8]]]] + [math + ["." random (#+ Random)] + [number + ["." nat]]]] + {1 + ["." / + ["/#" // + ["#." status]]]}) + +(def: #export test + Test + (<| (_.covering /._) + (_.for [/.Client]) + (do random.monad + [on_post random.nat + on_get random.nat + on_put random.nat + on_patch random.nat + on_delete random.nat + on_head random.nat + on_connect random.nat + on_options random.nat + on_trace random.nat + #let [mock (: (/.Client IO) + (implementation + (def: (request method url headers data) + (io.io (let [value (case method + #//.Post on_post + #//.Get on_get + #//.Put on_put + #//.Patch on_patch + #//.Delete on_delete + #//.Head on_head + #//.Connect on_connect + #//.Options on_options + #//.Trace on_trace) + data (|> value + (\ nat.decimal encode) + (\ utf8.codec encode))] + (#try.Success [//status.ok + {#//.headers headers + #//.body (function (_ ?wanted_bytes) + (io.io (#try.Success [(binary.size data) + data])))}]))))))]] + (`` ($_ _.and + (~~ (template [<definition> <expected>] + [(_.cover [<definition>] + (|> (<definition> "" //.empty #.None mock) + (do> try.monad + [io.run] + [product.right (get@ #//.body) (function.apply #.None) io.run] + [product.right (\ utf8.codec decode)] + [(\ nat.decimal decode)] + [(nat.= <expected>) wrap]) + (try.default false)))] + + [/.post on_post] + [/.get on_get] + [/.put on_put] + [/.patch on_patch] + [/.delete on_delete] + [/.head on_head] + [/.connect on_connect] + [/.options on_options] + [/.trace on_trace] + )) + ))))) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index fa7d77f22..334250a96 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -35,7 +35,7 @@ (def: (simulation [environment working_directory command arguments]) (-> [Environment Path /.Command (List /.Argument)] (/.Simulation Bit)) - (structure + (implementation (def: (on_read dead?) (if dead? (exception.throw ..dead []) @@ -65,14 +65,14 @@ (def: (io_shell command oops input destruction exit) (-> /.Command Text Text Text /.Exit (/.Shell IO)) - (structure + (implementation (def: execute ((debug.private /.can_execute) (function (_ [environment working_directory command arguments]) (io.io (#try.Success (: (/.Process IO) - (structure + (implementation (def: read ((debug.private /.can_read) (function (_ _) |