From 4f4a96635abb04239102e4b72dc2a9c6f678dcd2 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 22 Dec 2022 15:51:13 -0400 Subject: Now showing stack-traces for runtime exceptions in Ruby. --- lux-ruby/source/program.lux | 3 +- stdlib/source/library/lux/ffi/export.rb.lux | 2 +- .../language/lux/phase/extension/analysis/ruby.lux | 5 +- .../phase/extension/translation/ruby/common.lux | 12 +- .../lux/phase/extension/translation/ruby/host.lux | 5 +- .../language/lux/phase/translation/ruby.lux | 6 +- .../lux/meta/compiler/language/lux/translation.lux | 18 +- stdlib/source/library/lux/meta/target/ruby.lux | 3 +- stdlib/source/library/lux/world/file.lux | 9 +- .../world/finance/market/analysis/pivot_point.lux | 78 ++++++ stdlib/source/library/lux/world/shell.lux | 2 +- stdlib/source/program/aedifex/artifact.lux | 9 +- .../source/program/aedifex/artifact/snapshot.lux | 2 +- .../aedifex/artifact/snapshot/version/value.lux | 2 +- stdlib/source/program/aedifex/cli.lux | 2 +- stdlib/source/program/aedifex/command/build.lux | 5 +- .../program/aedifex/dependency/resolution.lux | 2 +- stdlib/source/program/aedifex/local.lux | 5 +- stdlib/source/program/aedifex/metadata.lux | 7 +- stdlib/source/program/aedifex/pom.lux | 2 +- stdlib/source/program/aedifex/profile.lux | 2 +- stdlib/source/program/aedifex/repository/local.lux | 7 +- .../source/program/aedifex/repository/origin.lux | 2 +- .../source/program/aedifex/repository/remote.lux | 5 +- .../source/specification/lux/abstract/comonad.lux | 53 ---- stdlib/source/specification/lux/abstract/monad.lux | 59 ----- stdlib/source/test/lux.lux | 4 +- stdlib/source/test/lux/abstract/comonad.lux | 44 +++- stdlib/source/test/lux/abstract/comonad/free.lux | 6 +- stdlib/source/test/lux/abstract/monad.lux | 63 ++++- stdlib/source/test/lux/abstract/monad/free.lux | 13 +- .../source/test/lux/control/concurrency/async.lux | 9 +- stdlib/source/test/lux/control/concurrency/csp.lux | 9 +- stdlib/source/test/lux/control/concurrency/frp.lux | 9 +- .../test/lux/control/concurrency/incremental.lux | 4 +- stdlib/source/test/lux/control/concurrency/stm.lux | 9 +- .../test/lux/control/concurrency/structured.lux | 9 +- stdlib/source/test/lux/control/continuation.lux | 9 +- .../test/lux/control/function/trampoline.lux | 9 +- stdlib/source/test/lux/control/io.lux | 9 +- stdlib/source/test/lux/control/lazy.lux | 6 +- stdlib/source/test/lux/control/maybe.lux | 8 +- stdlib/source/test/lux/control/parser.lux | 9 +- stdlib/source/test/lux/control/reader.lux | 9 +- stdlib/source/test/lux/control/region.lux | 9 +- stdlib/source/test/lux/control/security/policy.lux | 9 +- stdlib/source/test/lux/control/state.lux | 12 +- stdlib/source/test/lux/control/thread.lux | 9 +- stdlib/source/test/lux/control/try.lux | 6 +- stdlib/source/test/lux/control/writer.lux | 9 +- stdlib/source/test/lux/data/collection/list.lux | 8 +- .../source/test/lux/data/collection/sequence.lux | 8 +- stdlib/source/test/lux/data/collection/stream.lux | 6 +- .../test/lux/data/collection/tree/zipper.lux | 7 +- stdlib/source/test/lux/data/color/cmyk.lux | 15 +- stdlib/source/test/lux/data/color/hsb.lux | 15 +- stdlib/source/test/lux/data/color/hsl.lux | 15 +- stdlib/source/test/lux/data/identity.lux | 12 +- stdlib/source/test/lux/math/random.lux | 9 +- stdlib/source/test/lux/meta.lux | 284 ++++++++++----------- .../source/test/lux/meta/compiler/language/lux.lux | 15 +- .../test/lux/meta/compiler/language/lux/phase.lux | 210 +++++++++++++++ .../lux/meta/compiler/language/lux/translation.lux | 76 ++++++ stdlib/source/test/lux/meta/compiler/phase.lux | 208 --------------- stdlib/source/test/lux/meta/type/check.lux | 9 +- stdlib/source/test/lux/world.lux | 4 +- .../market/analysis/accumulation_distribution.lux | 2 +- .../world/finance/market/analysis/pivot_point.lux | 40 +++ stdlib/source/test/lux/world/finance/money.lux | 19 +- .../test/lux/world/finance/trade/session.lux | 18 +- 70 files changed, 884 insertions(+), 695 deletions(-) create mode 100644 stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux delete mode 100644 stdlib/source/specification/lux/abstract/comonad.lux delete mode 100644 stdlib/source/specification/lux/abstract/monad.lux create mode 100644 stdlib/source/test/lux/meta/compiler/language/lux/phase.lux create mode 100644 stdlib/source/test/lux/meta/compiler/language/lux/translation.lux delete mode 100644 stdlib/source/test/lux/meta/compiler/phase.lux create mode 100644 stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 5febd0b8f..6242b3b61 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -33,7 +33,6 @@ ["^" pattern] ["[0]" template]] ["[0]" compiler - ["[0]" phase (.only Operation Phase) (.use "[1]#[0]" monad)] [reference [variable (.only Register)]] [language @@ -43,7 +42,7 @@ ["[0]" synthesis] [analysis [macro (.only Expander)]] - [phase + ["[0]" phase (.only Operation Phase) (.use "[1]#[0]" monad) ["[0]" extension (.only Extender Handler) ["[0]" analysis ["[1]" ruby]] diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index bd76976e7..ec871f1d2 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -28,8 +28,8 @@ ["[0]" dependency ["[1]" artifact]]]] [language - ["[0]" phase] [lux + ["[0]" phase] ["[0]" translation] ["[0]" declaration] ["[0]" analysis diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux index de66972a1..9e85ce56b 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -23,10 +23,9 @@ [/// ["[0]" extension] [// + ["[0]" phase] ["[0]" analysis (.only Analysis Operation Phase Handler Bundle) - ["[1]/[0]" type]] - [/// - ["[0]" phase]]]]]) + ["[1]/[0]" type]]]]]) (def array::new (-> Text Handler) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux index 151cf3c74..f5facd483 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/common.lux @@ -40,11 +40,10 @@ ["[1][0]" when] ["[1][0]" loop]]] [// + ["[0]" phase (.use "[1]#[0]" monad)] ["[0]" translation] ["[0]" synthesis (.only %synthesis) - ["<[1]>" \\parser (.only Parser)]] - [/// - ["[0]" phase (.use "[1]#[0]" monad)]]]]) + ["<[1]>" \\parser (.only Parser)]]]]) (def .public (custom [parser handler]) (All (_ s) @@ -239,7 +238,12 @@ (def io//error! (Unary Expression) - _.raise) + (let [stack_trace (_.do "join" (list (_.string text.new_line)) + {.#None} + _.caller/0)] + (|>> (_.+ (_.string (%.format text.new_line text.new_line))) + (_.+ stack_trace) + _.raise))) (def with_io_extensions (-> Bundle Bundle) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux index 982c33f38..aebe5f445 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/translation/ruby/host.lux @@ -27,10 +27,9 @@ ["[0]" runtime (.only Operation Phase Handler Bundle with_vars)]]] [// + ["[0]" phase] ["[0]" synthesis - ["?[1]" \\parser (.only Parser)]] - [/// - ["[0]" phase]]]]]) + ["?[1]" \\parser (.only Parser)]]]]]) (def (array::new [size]) (Unary Expression) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux index 427411877..95fa56148 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/ruby.lux @@ -27,9 +27,9 @@ ["[1]/[0]" common]]]] ["/[1]" // [analysis (.only)] + ["[0]" phase (.use "[1]#[0]" monad)] ["[1][0]" synthesis] ["//[1]" /// - ["[1][0]" phase (.use "[1]#[0]" monad)] [reference (.only) [variable (.only)]]]]]]]) @@ -42,7 +42,7 @@ (when synthesis (^.with_template [ ] [( @ value) - (//////phase#in ( value))]) + (phase#in ( value))]) ([////synthesis.bit /primitive.bit] [////synthesis.i64 /primitive.i64] [////synthesis.f64 /primitive.f64] @@ -69,7 +69,7 @@ [////synthesis.function/abstraction /function.function]) (////synthesis.loop/again @ _) - (//////phase.except ..cannot_recur_as_an_expression []) + (phase.except ..cannot_recur_as_an_expression []) [@ {////synthesis.#Reference value}] (//reference.reference /reference.system archive value) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux b/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux index cb92a5e51..fc6ab8350 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/translation.lux @@ -58,18 +58,24 @@ (type .public (Host expression declaration) (Interface - (is (-> unit.ID [(Maybe unit.ID) expression] (Try Any)) + (is (-> unit.ID [(Maybe unit.ID) expression] + (Try Any)) evaluate) - (is (-> declaration (Try Any)) + (is (-> declaration + (Try Any)) execute) - (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Try [Text Any declaration])) + (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] + (Try [Text Any declaration])) define) - (is (-> unit.ID Binary declaration) + (is (-> unit.ID Binary + declaration) ingest) - (is (-> unit.ID (Maybe Text) declaration (Try Any)) + (is (-> unit.ID (Maybe Text) declaration + (Try Any)) re_learn) - (is (-> unit.ID (Maybe Text) declaration (Try Any)) + (is (-> unit.ID (Maybe Text) declaration + (Try Any)) re_load))) (type .public (State anchor expression declaration) diff --git a/stdlib/source/library/lux/meta/target/ruby.lux b/stdlib/source/library/lux/meta/target/ruby.lux index 82fbaa9b4..c47ea733c 100644 --- a/stdlib/source/library/lux/meta/target/ruby.lux +++ b/stdlib/source/library/lux/meta/target/ruby.lux @@ -506,7 +506,8 @@ ))] [0 - [["gets"]]] + [["gets"] + ["caller"]]] [1 [["print"] diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 94bea7fad..997330d7f 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -1255,7 +1255,9 @@ (in (|> |store| (..retrieve_mock_file! separator path) (try#each (|>> product.right - (the #mock_content)))))))) + (the #mock_content) + (composite identity) + (with binary.monoid)))))))) (def (delete path) (stm.commit! @@ -1273,7 +1275,10 @@ (do async.monad [now (async.future instant.now)] (stm.commit! - (..attempt! (..update_mock_file! separator path now content) store)))) + (..attempt! (..update_mock_file! separator path now + (with binary.monoid + (composite identity content))) + store)))) (def (append path content) (do async.monad diff --git a/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux new file mode 100644 index 000000000..8b0693abb --- /dev/null +++ b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux @@ -0,0 +1,78 @@ +(.require + [library + [lux (.except Analysis) + [control + ["[0]" maybe]] + [math + [number + ["n" nat]]] + [world + [time + ["[0]" series (.only Series) (.use "[1]#[0]" functor)]]]]] + [/// + [price (.only Price)] + [// + ["[0]" money] + [trade + ["[0]" session (.only Session)]]]]) + +... https://en.wikipedia.org/wiki/Typical_price +(def .public (typical_price it) + (All (_ $) + (-> (Session $) + (Price $))) + (|> (all money.+ + (the session.#high it) + (the session.#low it) + + (the session.#open it) + (the session.#close it)) + money.amount + (n./ 4) + (money.money (money.currency (the session.#close it))))) + +... https://en.wikipedia.org/wiki/Pivot_point_(technical_analysis) +(type .public (Central_Pivot_Range $) + (Record + [#top_central (Price $) + #pivot_point (Price $) + #bottom_central (Price $)])) + +(def (bottom_central it) + (All (_ $) + (-> (Session $) + (Price $))) + (|> (all money.+ + (the session.#high it) + (the session.#low it)) + money.amount + (n./ 2) + (money.money (money.currency (the session.#high it))))) + +(def (top_central pivot_point bottom_central) + (All (_ $) + (-> (Price $) (Price $) + (Price $))) + (|> pivot_point + (money.+ pivot_point) + (money.- bottom_central) + maybe.trusted)) + +(def .public (central_pivot_range it) + (All (_ $) + (-> (Session $) + (Central_Pivot_Range $))) + (let [pivot_point (typical_price it) + bottom_central (bottom_central it)] + [#top_central (top_central pivot_point bottom_central) + #pivot_point pivot_point + #bottom_central bottom_central])) + +(type .public (Analysis from to) + (-> (Series from) + (Series to))) + +(def .public analysis + (All (_ $) + (Analysis (Session $) (Central_Pivot_Range $))) + (series#each ..central_pivot_range)) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 57535fb3b..d74bdc120 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -188,7 +188,7 @@ (import (java/util/Map k v) "[1]::[0]" - (put [k v] v)) + (put [k v] "?" v)) (def (jvm::load_environment input target) (-> Environment diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index 3b83909e0..d913d9db3 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except local #version) [abstract [equivalence (.only Equivalence)] [order (.only Order)] @@ -14,7 +14,8 @@ [world ["[0]" file (.only Path)] [net - ["[0]" uri (.only URI)]]]]]) + [uri (.only URI) + ["[0]" path]]]]]]) (type .public Group Text) @@ -93,14 +94,14 @@ (def .public (bundle version artifact) (-> Version Artifact URI) - (let [/ uri.separator + (let [/ path.separator group (..directory / (the #group artifact)) name (the #name artifact)] (%.format group / name / version))) (def .public (uri version artifact) (-> Version Artifact URI) - (let [/ uri.separator] + (let [/ path.separator] (%.format (..bundle version artifact) / (..identity artifact)))) (def .public (local artifact) diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux index df36e1d0d..6cde5e5f2 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Type) + [lux (.except Type #Local) [abstract [equivalence (.only Equivalence)] [monad (.only do)]] diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux index 51a571ab8..2fd32b251 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except) + [lux (.except #version) [abstract [equivalence (.only Equivalence)]] [data diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index 338c02aa0..ca2c60bfb 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except) + [lux (.except #Build) [abstract [equivalence (.only Equivalence)] [monad (.only do)]] diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 71c87d8ce..189f57bbe 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -39,7 +39,8 @@ ["[0]" shell (.only Exit Process Shell)] ["[0]" console (.only Console)] [net - ["[0]" uri]]]]] + [uri + ["[0]" path]]]]]] ["[0]" /// ["[1]" profile] ["[1][0]" action] @@ -125,7 +126,7 @@ artifact (the ///dependency.#artifact dependency)] (|> artifact (///local.uri (the ///artifact.#version artifact)) - (text.replaced uri.separator /) + (text.replaced path.separator /) (format home /) (text.suffix (format "." (the ///dependency.#type dependency)))))) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 62a85a974..ae05fb4c1 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except all) + [lux (.except Tag all) ["[0]" debug] ["[0]" ffi (.only import)] [abstract diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux index 157cb24eb..4ac42d6e7 100644 --- a/stdlib/source/program/aedifex/local.lux +++ b/stdlib/source/program/aedifex/local.lux @@ -6,11 +6,12 @@ ["%" \\format (.only format)]]] [world [net - ["[0]" uri (.only URI)]]]]] + [uri (.only URI) + ["[0]" path]]]]]] ["[0]" // ["[1][0]" artifact (.only Version Artifact)]]) -(def / uri.separator) +(def / path.separator) (def .public repository URI diff --git a/stdlib/source/program/aedifex/metadata.lux b/stdlib/source/program/aedifex/metadata.lux index 2608d146c..9f9cbfcc9 100644 --- a/stdlib/source/program/aedifex/metadata.lux +++ b/stdlib/source/program/aedifex/metadata.lux @@ -7,7 +7,8 @@ [world [file (.only Path)] [net - ["[0]" uri (.only URI)]]]]] + [uri (.only URI) + ["[0]" path]]]]]] ["[0]" // ["[1][0]" artifact (.only Artifact)]]) @@ -17,7 +18,7 @@ (def .public (remote_artifact_uri artifact) (-> Artifact URI) - (let [/ uri.separator] + (let [/ path.separator] (format (//artifact.directory / (the //artifact.#group artifact)) / (the //artifact.#name artifact) / (the //artifact.#version artifact) @@ -25,7 +26,7 @@ (def .public (remote_project_uri artifact) (-> Artifact URI) - (let [/ uri.separator] + (let [/ path.separator] (format (//artifact.directory / (the //artifact.#group artifact)) / (the //artifact.#name artifact) / ..remote_file))) diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index afcfc29f6..5e26bb060 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except) + [lux (.except Tag) [abstract [monad (.only do)]] [control diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 674865cdd..55dfc915f 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Info Source Module) + [lux (.except Info Source Module #info #target #configuration) [abstract [monoid (.only Monoid)] [equivalence (.only Equivalence)]] diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index 4223ddf39..8f3c1cfb7 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -14,7 +14,8 @@ [environment (.only Environment)] ["[0]" file] [net - ["[0]" uri (.only URI)]]]]] + [uri (.only URI) + ["[0]" path]]]]]] ["[0]" // (.only) ["/[1]" // ["[1][0]" local] @@ -24,12 +25,12 @@ (-> (Environment Async) (file.System Async) file.Path) (let [/ (of fs separator)] (|> ///local.repository - (text.replaced uri.separator /) + (text.replaced path.separator /) (format (of environment home) /)))) (def (path /) (-> Text (-> URI file.Path)) - (text.replaced uri.separator /)) + (text.replaced path.separator /)) (def (absolute_path environment fs) (-> (Environment Async) (file.System Async) (-> URI file.Path)) diff --git a/stdlib/source/program/aedifex/repository/origin.lux b/stdlib/source/program/aedifex/repository/origin.lux index e8b9c22a4..c813b7680 100644 --- a/stdlib/source/program/aedifex/repository/origin.lux +++ b/stdlib/source/program/aedifex/repository/origin.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except) + [lux (.except #Local) [abstract [equivalence (.only Equivalence)]] [data diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 9386c214f..61972682a 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -21,6 +21,7 @@ [net (.only URL) [uri (.only URI)] ["[0]" http + ["[0]" response (.only Response)] ["[1]" client] ["[1]/[0]" status] ["@[1]" /]]]]]] @@ -62,7 +63,7 @@ address) (def (download uri) (do [! (try.with io.monad)] - [[status message] (is (IO (Try (@http.Response IO))) + [[status message] (is (IO (Try (Response IO))) (http.get (format address uri) (http.headers ..base_headers) {.#None} @@ -78,7 +79,7 @@ (def (upload uri content) (do (try.with io.monad) - [[status message] (is (IO (Try (@http.Response IO))) + [[status message] (is (IO (Try (Response IO))) (http.put (format address uri) (http.headers (when identity {.#None} diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux deleted file mode 100644 index 2b89691ec..000000000 --- a/stdlib/source/specification/lux/abstract/comonad.lux +++ /dev/null @@ -1,53 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)] - ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]]] - [math - ["[0]" random] - [number - ["n" nat]]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only CoMonad)]]) - -(def .public (spec injection comparison it) - (All (_ f) (-> (Injection f) (Comparison f) (CoMonad f) Test)) - (<| (_.for [/.CoMonad]) - (do [! random.monad] - [.let [(open "/#[0]") it] - sample random.nat - increase (of ! each (function (_ diff) - (|>> /#out (n.+ diff))) - random.nat) - decrease (of ! each (function (_ diff) - (|>> /#out (n.- diff))) - random.nat) - morphism (of ! each (function (_ diff) - (|>> /#out (n.+ diff))) - random.nat) - .let [start (injection sample) - == (comparison n.=)]]) - (all _.and - (_.for [/.functor] - (functorT.spec injection comparison (the /.functor it))) - - (_.coverage [/.disjoint /.out] - (let [left_identity! - (n.= (morphism start) - (|> start /#disjoint (/#each morphism) /#out)) - - right_identity! - (== start - (|> start /#disjoint (/#each /#out))) - - associativity! - (== (|> start /#disjoint (/#each (|>> /#disjoint (/#each increase) decrease))) - (|> start /#disjoint (/#each increase) /#disjoint (/#each decrease)))] - (and left_identity! - right_identity! - associativity!))) - ))) diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux deleted file mode 100644 index 48db743b8..000000000 --- a/stdlib/source/specification/lux/abstract/monad.lux +++ /dev/null @@ -1,59 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [functor - [\\test (.only Injection Comparison)]]] - [math - ["[0]" random] - [number - ["n" nat]]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only do)]]) - -(def (left_identity injection comparison (open "_//[0]")) - (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) - (do [! random.monad] - [sample random.nat - morphism (of ! each (function (_ diff) - (|>> (n.+ diff) _//in)) - random.nat)] - (_.test "Left identity." - ((comparison n.=) - (|> (injection sample) (_//each morphism) _//conjoint) - (morphism sample))))) - -(def (right_identity injection comparison (open "_//[0]")) - (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) - (do random.monad - [sample random.nat] - (_.test "Right identity." - ((comparison n.=) - (|> (injection sample) (_//each _//in) _//conjoint) - (injection sample))))) - -(def (associativity injection comparison (open "_//[0]")) - (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) - (do [! random.monad] - [sample random.nat - increase (of ! each (function (_ diff) - (|>> (n.+ diff) _//in)) - random.nat) - decrease (of ! each (function (_ diff) - (|>> (n.- diff) _//in)) - random.nat)] - (_.test "Associativity." - ((comparison n.=) - (|> (injection sample) (_//each increase) _//conjoint (_//each decrease) _//conjoint) - (|> (injection sample) (_//each (|>> increase (_//each decrease) _//conjoint)) _//conjoint))))) - -(def .public (spec injection comparison monad) - (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) - (<| (_.for [/.Monad]) - (all _.and - (..left_identity injection comparison monad) - (..right_identity injection comparison monad) - (..associativity injection comparison monad) - ))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 068727e9f..bda6c17fc 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -6,6 +6,7 @@ [monad (.only do)]] [control ["[0]" io] + ["[0]" try] ["[0]" maybe (.use "[1]#[0]" functor)] [concurrency ["[0]" atom (.only Atom)]]] @@ -567,7 +568,8 @@ .let [existential_type (of ! each (|>> {.#Ex}) random.nat)] expected/0 existential_type expected/1 existential_type] - (<| (_.for [/.Type]) + (<| (_.for [/.Type + /.#Nominal /.#Sum /.#Product /.#Function /.#Parameter /.#Var /.#Ex /.#UnivQ /.#ExQ /.#Apply /.#Named]) (all _.and (_.coverage [/.is] (|> expected diff --git a/stdlib/source/test/lux/abstract/comonad.lux b/stdlib/source/test/lux/abstract/comonad.lux index 1ffb461c8..69a5699f7 100644 --- a/stdlib/source/test/lux/abstract/comonad.lux +++ b/stdlib/source/test/lux/abstract/comonad.lux @@ -2,7 +2,9 @@ [library [lux (.except) [abstract - [monad (.only do)]] + [monad (.only do)] + ["[0]" functor + ["[1]T" \\test (.only Injection Comparison)]]] [data ["[0]" identity (.only Identity)]] [math @@ -27,3 +29,43 @@ [value (out sample)] (out (++ value)))))) )))) + +(def .public (spec injection comparison it) + (All (_ !) + (-> (Injection !) (Comparison !) (/.CoMonad !) + Test)) + (<| (_.for [/.CoMonad]) + (do [! random.monad] + [.let [(open "/#[0]") it] + sample random.nat + increase (of ! each (function (_ diff) + (|>> /#out (n.+ diff))) + random.nat) + decrease (of ! each (function (_ diff) + (|>> /#out (n.- diff))) + random.nat) + morphism (of ! each (function (_ diff) + (|>> /#out (n.+ diff))) + random.nat) + .let [start (injection sample) + == (comparison n.=)]]) + (all _.and + (_.for [/.functor] + (functorT.spec injection comparison (the /.functor it))) + + (_.coverage [/.disjoint /.out] + (let [left_identity! + (n.= (morphism start) + (|> start /#disjoint (/#each morphism) /#out)) + + right_identity! + (== start + (|> start /#disjoint (/#each /#out))) + + associativity! + (== (|> start /#disjoint (/#each (|>> /#disjoint (/#each increase) decrease))) + (|> start /#disjoint (/#each increase) /#disjoint (/#each decrease)))] + (and left_identity! + right_identity! + associativity!))) + ))) diff --git a/stdlib/source/test/lux/abstract/comonad/free.lux b/stdlib/source/test/lux/abstract/comonad/free.lux index 8e9d67122..10cd3ac24 100644 --- a/stdlib/source/test/lux/abstract/comonad/free.lux +++ b/stdlib/source/test/lux/abstract/comonad/free.lux @@ -5,8 +5,8 @@ [comonad (.only CoMonad)] ["[0]" functor (.only Functor) ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" comonad]]] + ["[0]" comonad + ["[1]T" \\test]]] [control ["//" continuation]] [data @@ -47,6 +47,6 @@ (functorT.spec ..injection ..comparison (is (Functor (/.Free Stream)) (/.functor stream.functor)))) (_.for [/.comonad] - ($comonad.spec ..injection ..comparison (is (CoMonad (/.Free Stream)) + (comonadT.spec ..injection ..comparison (is (CoMonad (/.Free Stream)) (/.comonad stream.functor)))) ))) diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index e35a07a2a..5cf985999 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -1,6 +1,9 @@ (.require [library [lux (.except) + [abstract + [functor + [\\test (.only Injection Comparison)]]] [data ["[0]" identity (.only Identity)] [collection @@ -12,11 +15,65 @@ [test ["_" property (.only Test)]]]] [\\library - ["[0]" / (.only Monad do)]] + ["[0]" / (.only do) + ["[0]" free]]] ["[0]" / ["[1][0]" free] ["[1][0]" indexed]]) +(def (left_identity injection comparison (open "_//[0]")) + (All (_ !) + (-> (Injection !) (Comparison !) (/.Monad !) + Test)) + (do [! random.monad] + [sample random.nat + morphism (of ! each (function (_ diff) + (|>> (n.+ diff) _//in)) + random.nat)] + (_.test "Left identity." + ((comparison n.=) + (|> (injection sample) (_//each morphism) _//conjoint) + (morphism sample))))) + +(def (right_identity injection comparison (open "_//[0]")) + (All (_ !) + (-> (Injection !) (Comparison !) (/.Monad !) + Test)) + (do random.monad + [sample random.nat] + (_.test "Right identity." + ((comparison n.=) + (|> (injection sample) (_//each _//in) _//conjoint) + (injection sample))))) + +(def (associativity injection comparison (open "_//[0]")) + (All (_ !) + (-> (Injection !) (Comparison !) (/.Monad !) + Test)) + (do [! random.monad] + [sample random.nat + increase (of ! each (function (_ diff) + (|>> (n.+ diff) _//in)) + random.nat) + decrease (of ! each (function (_ diff) + (|>> (n.- diff) _//in)) + random.nat)] + (_.test "Associativity." + ((comparison n.=) + (|> (injection sample) (_//each increase) _//conjoint (_//each decrease) _//conjoint) + (|> (injection sample) (_//each (|>> increase (_//each decrease) _//conjoint)) _//conjoint))))) + +(def .public (spec injection comparison monad) + (All (_ !) + (-> (Injection !) (Comparison !) (/.Monad !) + Test)) + (<| (_.for [/.Monad]) + (all _.and + (..left_identity injection comparison monad) + (..right_identity injection comparison monad) + (..associativity injection comparison monad) + ))) + (def .public test Test (do random.monad @@ -67,5 +124,9 @@ (is (Identity Nat))))) /free.test + (_.for [free.monad] + (..spec /free.injection /free.comparison (is (/.Monad (free.Free List)) + (free.monad list.functor)))) + /indexed.test )))) diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 5d786ae19..760acc2aa 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -4,13 +4,11 @@ [abstract [functor (.only Functor)] [apply (.only Apply)] - [monad (.only Monad do)] + ["[0]" monad (.only do)] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [data [collection ["[0]" list (.use "[1]#[0]" functor)]]] @@ -21,7 +19,7 @@ [\\library ["[0]" /]]) -(def injection +(def .public injection (Injection (/.Free List)) (|>> {/.#Pure})) @@ -36,7 +34,7 @@ (list#each interpret) list.together))) -(def comparison +(def .public comparison (Comparison (/.Free List)) (function (_ == left right) (of (list.equivalence ==) = @@ -54,7 +52,4 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison (is (Apply (/.Free List)) (/.apply list.functor)))) - (_.for [/.monad] - ($monad.spec ..injection ..comparison (is (Monad (/.Free List)) - (/.monad list.functor)))) ))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 64bc1e119..efa1e26dc 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" io]] [math @@ -70,7 +69,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (in (do /.monad [.let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] diff --git a/stdlib/source/test/lux/control/concurrency/csp.lux b/stdlib/source/test/lux/control/concurrency/csp.lux index 057ff60c8..682f36f73 100644 --- a/stdlib/source/test/lux/control/concurrency/csp.lux +++ b/stdlib/source/test/lux/control/concurrency/csp.lux @@ -2,11 +2,10 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test (.only Injection Comparison)]]] [control ["[0]" io] ["[0]" try] @@ -51,7 +50,7 @@ (_.for [/.functor] (functorT.spec ..injection ..comparison /.functor)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) )) (_.coverage [/.Channel /.Channel' /.Sink /.channel] ... This is already been tested for the FRP module. diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index d2d43363c..92b484fbb 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" try] ["[0]" exception] @@ -85,7 +84,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.Channel /.Sink /.channel] (when (io.run! diff --git a/stdlib/source/test/lux/control/concurrency/incremental.lux b/stdlib/source/test/lux/control/concurrency/incremental.lux index 380da6f50..f66b872b3 100644 --- a/stdlib/source/test/lux/control/concurrency/incremental.lux +++ b/stdlib/source/test/lux/control/concurrency/incremental.lux @@ -4,9 +4,7 @@ [abstract [monad (.only do)] ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test (.only Injection Comparison)]]] [control ["[0]" io] ["[0]" try] diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 1db0c216d..e3a4a6e81 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - ["[0]" monad (.only Monad do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" io (.only IO)]] [data @@ -52,7 +51,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (in (do async.monad [actual (/.commit! (of /.monad in expected))] diff --git a/stdlib/source/test/lux/control/concurrency/structured.lux b/stdlib/source/test/lux/control/concurrency/structured.lux index 93b62c414..206448d2f 100644 --- a/stdlib/source/test/lux/control/concurrency/structured.lux +++ b/stdlib/source/test/lux/control/concurrency/structured.lux @@ -2,11 +2,10 @@ [library [lux (.except) [abstract - ["[0]" monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test (.only Injection Comparison)]]] [control ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" try] @@ -75,7 +74,7 @@ (_.for [/.functor] (functorT.spec ..injection ..comparison /.functor)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (in (do async.monad [leftA (<| /.async diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 28f834949..1aea88eb9 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [data [collection ["[0]" list]]] @@ -45,7 +44,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.result] (n.= sample (/.result (_#in sample)))) diff --git a/stdlib/source/test/lux/control/function/trampoline.lux b/stdlib/source/test/lux/control/function/trampoline.lux index c9ab584a4..23cc63862 100644 --- a/stdlib/source/test/lux/control/function/trampoline.lux +++ b/stdlib/source/test/lux/control/function/trampoline.lux @@ -2,11 +2,10 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test (.only Injection Comparison)]]] [math ["[0]" random] [number @@ -37,7 +36,7 @@ (_.for [/.functor] (functorT.spec ..injection ..comparison /.functor)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.for [/.result] (all _.and diff --git a/stdlib/source/test/lux/control/io.lux b/stdlib/source/test/lux/control/io.lux index b280ca903..28cf8b92c 100644 --- a/stdlib/source/test/lux/control/io.lux +++ b/stdlib/source/test/lux/control/io.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [math ["[0]" random] [number @@ -42,7 +41,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.run! /.io] (n.= sample diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux index 9bb545a40..58ce73b97 100644 --- a/stdlib/source/test/lux/control/lazy.lux +++ b/stdlib/source/test/lux/control/lazy.lux @@ -2,13 +2,13 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply ["[1]T" \\test]] [\\specification - ["$[0]" monad] ["$[0]" equivalence]]] [data ["[0]" product]] @@ -53,7 +53,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.lazy] (let [lazy (/.lazy ) diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index 0782a7ad2..afa6200aa 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -2,15 +2,15 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test]] ["[0]" apply ["[1]T" \\test]] [\\specification ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monad]] + ["$[0]" hash]] ["[0]" monoid ["[1]T" \\test]]] [control @@ -48,7 +48,7 @@ (_.for [/.apply] (applyT.spec /#in /.equivalence /.apply)) (_.for [/.monad] - ($monad.spec /#in /.equivalence /.monad)) + (monadT.spec /#in /.equivalence /.monad)) (do random.monad [left random.nat diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 3b145cec8..83755d702 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -2,14 +2,13 @@ [library [lux (.except) [abstract - [monad (.only do)] [equivalence (.only Equivalence)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" try (.only Try)]] [data @@ -350,7 +349,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.result] (|> (/.result (of /.monad in expected) (list)) diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index 7213c78aa..fddf9d51c 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [math ["[0]" random] [number @@ -43,7 +42,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.result /.read] (n.= sample diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 32eed407b..70d3873a1 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -5,14 +5,13 @@ [equivalence (.only Equivalence)] [functor (.only Functor)] [apply (.only Apply)] - ["[0]" monad (.only Monad do)] ["[0]" enum] + ["[0]" monad (.only Monad do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" try (.only Try)]] [data @@ -94,7 +93,7 @@ (Apply (Region r (thread.Thread !)))) (/.apply thread.monad)))) (_.for [/.monad] - ($monad.spec ..injection ..comparison (is (All (_ ! r) + (monadT.spec ..injection ..comparison (is (All (_ ! r) (Monad (Region r (thread.Thread !)))) (/.monad thread.monad)))) diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 014ec5104..59f6968e3 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -3,13 +3,12 @@ [lux (.except) [abstract [hash (.only Hash)] - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] [math @@ -91,7 +90,7 @@ (_.for [/.apply] (applyT.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.apply)) (_.for [/.monad] - ($monad.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.monad)))) + (monadT.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.monad)))) (_.coverage [/.Privilege /.Context /.with_policy] (and (of policy_0 = password password) diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index e66466eb0..90bcd3fef 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" pipe] ["[0]" io]] @@ -78,7 +77,7 @@ (_.for [/.apply] (applyT.spec ..injection (..comparison state) /.apply)) (_.for [/.monad] - ($monad.spec ..injection (..comparison state) /.monad)) + (monadT.spec ..injection (..comparison state) /.monad)) ))) (def loops @@ -130,4 +129,5 @@ ..basics ..structures ..loops - ..monad_transformer))) + ..monad_transformer + ))) diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux index ac265c742..f396fd025 100644 --- a/stdlib/source/test/lux/control/thread.lux +++ b/stdlib/source/test/lux/control/thread.lux @@ -2,13 +2,12 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [math ["[0]" random] [number @@ -55,7 +54,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) )) (_.for [/.Box /.box] diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 159fcfd7f..c46699836 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -2,13 +2,13 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply ["[1]T" \\test]] [\\specification - ["$[0]" monad] ["$[0]" equivalence]]] [control ["[0]" pipe] @@ -57,7 +57,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.coverage [/.trusted] (n.= expected diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index 288859d4a..43186db74 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -4,13 +4,12 @@ [abstract [equivalence (.only Equivalence)] [monoid (.only Monoid)] - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" io]] [data @@ -48,7 +47,7 @@ (_.for [/.apply] (applyT.spec (..injection text.monoid) ..comparison (/.apply text.monoid))) (_.for [/.monad] - ($monad.spec (..injection text.monoid) ..comparison (/.monad text.monoid))) + (monadT.spec (..injection text.monoid) ..comparison (/.monad text.monoid))) (_.coverage [/.write] (text#= log diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index cbcc11c3d..b73b76016 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -2,8 +2,9 @@ [library [lux (.except) [abstract - [monad (.only do)] ["[0]" enum] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test]] ["[0]" apply @@ -13,8 +14,7 @@ [\\specification ["$[0]" equivalence] ["$[0]" hash] - ["$[0]" mix] - ["$[0]" monad]]] + ["$[0]" mix]]] [control ["[0]" pipe] ["[0]" io] @@ -67,7 +67,7 @@ (_.for [/.apply] (applyT.spec /#in /.equivalence /.apply)) (_.for [/.monad] - ($monad.spec /#in /.equivalence /.monad)) + (monadT.spec /#in /.equivalence /.monad)) (do [! random.monad] [parameter random.nat diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index b2033b46f..ee463e2f7 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -2,7 +2,8 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection)]] ["[0]" apply @@ -11,8 +12,7 @@ ["[1]T" \\test]] [\\specification ["$[0]" equivalence] - ["$[0]" mix] - ["$[0]" monad]]] + ["$[0]" mix]]] [control ["[0]" try (.only Try)] ["[0]" exception]] @@ -47,7 +47,7 @@ (_.for [/.apply] (applyT.spec /#in /.equivalence /.apply)) (_.for [/.monad] - ($monad.spec /#in /.equivalence /.monad)) + (monadT.spec /#in /.equivalence /.monad)) ))) (def whole diff --git a/stdlib/source/test/lux/data/collection/stream.lux b/stdlib/source/test/lux/data/collection/stream.lux index 75c03aa36..902ce58b8 100644 --- a/stdlib/source/test/lux/data/collection/stream.lux +++ b/stdlib/source/test/lux/data/collection/stream.lux @@ -7,8 +7,8 @@ ["[0]" enum] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" comonad]]] + ["[0]" comonad + ["[1]T" \\test]]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -56,7 +56,7 @@ (_.for [/.functor] (functorT.spec /.repeated ..equivalence /.functor)) (_.for [/.comonad] - ($comonad.spec /.repeated ..equivalence /.comonad)) + (comonadT.spec /.repeated ..equivalence /.comonad)) (_.coverage [/.item] (n.= (n.+ offset index) diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 577862dc9..77d9209d8 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -5,9 +5,10 @@ [monad (.only do)] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] + ["[0]" comonad + ["[1]T" \\test]] [\\specification - ["$[0]" equivalence] - ["$[0]" comonad]]] + ["$[0]" equivalence]]] [control ["[0]" pipe] ["[0]" maybe (.use "[1]#[0]" functor)]] @@ -170,7 +171,7 @@ (_.for [/.functor] (functorT.spec (|>> tree.leaf /.zipper) /.equivalence /.functor)) (_.for [/.comonad] - ($comonad.spec (|>> tree.leaf /.zipper) /.equivalence /.comonad)) + (comonadT.spec (|>> tree.leaf /.zipper) /.equivalence /.comonad)) (_.coverage [/.zipper /.tree] (|> sample /.zipper /.tree (tree#= sample))) diff --git a/stdlib/source/test/lux/data/color/cmyk.lux b/stdlib/source/test/lux/data/color/cmyk.lux index 8c852cd4c..2eda4d6a8 100644 --- a/stdlib/source/test/lux/data/color/cmyk.lux +++ b/stdlib/source/test/lux/data/color/cmyk.lux @@ -45,14 +45,15 @@ expected_rgb rgbT.random expected_cmyk ..random - possible_value random.frac]) + possible_value random.frac + .let [delta +0.000000001]]) (all _.and (_.for [/.Value] (all _.and (_.coverage [/.value?] (and (/.value? expected_value) - (not (/.value? (f.+ f.smallest /.most))) - (not (/.value? (f.- f.smallest /.least))))) + (not (/.value? (f.+ delta /.most))) + (not (/.value? (f.- delta /.least))))) (_.coverage [/.value] (if (/.value? possible_value) (|> possible_value @@ -64,14 +65,14 @@ (and (f.< /.most /.least) (/.value? /.least) - (/.value? (f.+ f.smallest /.least)) - (not (/.value? (f.- f.smallest /.least))))) + (/.value? (f.+ delta /.least)) + (not (/.value? (f.- delta /.least))))) (_.coverage [/.most] (and (f.> /.least /.most) (/.value? /.most) - (/.value? (f.- f.smallest /.most)) - (not (/.value? (f.+ f.smallest /.most))))) + (/.value? (f.- delta /.most)) + (not (/.value? (f.+ delta /.most))))) )) (_.for [/.CMYK /.#cyan /.#magenta /.#yellow /.#key] diff --git a/stdlib/source/test/lux/data/color/hsb.lux b/stdlib/source/test/lux/data/color/hsb.lux index 2cb41fe7c..ee8d5f18a 100644 --- a/stdlib/source/test/lux/data/color/hsb.lux +++ b/stdlib/source/test/lux/data/color/hsb.lux @@ -38,14 +38,15 @@ expected_rgb rgbT.random expected_hsb ..random - possible_value random.frac]) + possible_value random.frac + .let [delta +0.000000001]]) (all _.and (_.for [/.Value] (all _.and (_.coverage [/.value?] (and (/.value? expected_value) - (not (/.value? (f.+ f.smallest /.most))) - (not (/.value? (f.- f.smallest /.least))))) + (not (/.value? (f.+ delta /.most))) + (not (/.value? (f.- delta /.least))))) (_.coverage [/.value] (if (/.value? possible_value) (|> possible_value @@ -57,14 +58,14 @@ (and (f.< /.most /.least) (/.value? /.least) - (/.value? (f.+ f.smallest /.least)) - (not (/.value? (f.- f.smallest /.least))))) + (/.value? (f.+ delta /.least)) + (not (/.value? (f.- delta /.least))))) (_.coverage [/.most] (and (f.> /.least /.most) (/.value? /.most) - (/.value? (f.- f.smallest /.most)) - (not (/.value? (f.+ f.smallest /.most))))) + (/.value? (f.- delta /.most)) + (not (/.value? (f.+ delta /.most))))) )) (_.for [/.HSB] (all _.and diff --git a/stdlib/source/test/lux/data/color/hsl.lux b/stdlib/source/test/lux/data/color/hsl.lux index 8563aa77b..bbfd8f8da 100644 --- a/stdlib/source/test/lux/data/color/hsl.lux +++ b/stdlib/source/test/lux/data/color/hsl.lux @@ -49,14 +49,15 @@ ((function (_ it) (and (f.>= +0.25 it) (f.<= +0.75 it))))))) - ratio (|> random.safe_frac (random.only (f.>= +0.5)))]) + ratio (|> random.safe_frac (random.only (f.>= +0.5))) + .let [delta +0.000000001]]) (all _.and (_.for [/.Value] (all _.and (_.coverage [/.value?] (and (/.value? expected_value) - (not (/.value? (f.+ f.smallest /.most))) - (not (/.value? (f.- f.smallest /.least))))) + (not (/.value? (f.+ delta /.most))) + (not (/.value? (f.- delta /.least))))) (_.coverage [/.value] (if (/.value? possible_value) (|> possible_value @@ -68,14 +69,14 @@ (and (f.< /.most /.least) (/.value? /.least) - (/.value? (f.+ f.smallest /.least)) - (not (/.value? (f.- f.smallest /.least))))) + (/.value? (f.+ delta /.least)) + (not (/.value? (f.- delta /.least))))) (_.coverage [/.most] (and (f.> /.least /.most) (/.value? /.most) - (/.value? (f.- f.smallest /.most)) - (not (/.value? (f.+ f.smallest /.most))))) + (/.value? (f.- delta /.most)) + (not (/.value? (f.+ delta /.most))))) )) (_.for [/.HSL /.#hue /.#saturation /.#luminance] diff --git a/stdlib/source/test/lux/data/identity.lux b/stdlib/source/test/lux/data/identity.lux index f18f69c41..5513d67d2 100644 --- a/stdlib/source/test/lux/data/identity.lux +++ b/stdlib/source/test/lux/data/identity.lux @@ -2,14 +2,14 @@ [library [lux (.except) [abstract - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply ["[1]T" \\test]] - [\\specification - ["$[0]" monad] - ["$[0]" comonad]]] + ["[0]" comonad + ["[1]T" \\test]]] [test ["_" property (.only Test)]]]] [\\library @@ -34,7 +34,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) (_.for [/.comonad] - ($comonad.spec ..injection ..comparison /.comonad)) + (comonadT.spec ..injection ..comparison /.comonad)) ))) diff --git a/stdlib/source/test/lux/math/random.lux b/stdlib/source/test/lux/math/random.lux index 8f125bd7e..881e73235 100644 --- a/stdlib/source/test/lux/math/random.lux +++ b/stdlib/source/test/lux/math/random.lux @@ -3,13 +3,12 @@ [lux (.except) [abstract [equivalence (.only Equivalence)] - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" maybe]] [data @@ -86,7 +85,7 @@ (_.for [/.apply] (applyT.spec ..injection (..comparison increase,seed) /.apply)) (_.for [/.monad] - ($monad.spec ..injection (..comparison increase,seed) /.monad)) + (monadT.spec ..injection (..comparison increase,seed) /.monad)) (_.coverage [/.result] (|> (in true) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 80f9231cf..8f693d82c 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -3,13 +3,12 @@ [lux (.except) [abstract [equivalence (.only Equivalence)] - [monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" maybe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)]] @@ -38,7 +37,7 @@ ["[0]" type (.use "[1]#[0]" equivalence)]]] ["[0]" / ["[1][0]" code] - ... ["[1][0]" location] + ["[1][0]" location] ... ["[1][0]" symbol] ... ["[1][0]" configuration] ... ["[1][0]" version] @@ -59,16 +58,6 @@ ... ["[1]/[0]" version] ... ["[1]/[0]" reference] ... ["[1]/[0]" phase] - ... [language - ... [lux - ... ... ["[1]/[0]" syntax] - ... ["[1]/[0]" analysis] - ... ["[1]/[0]" synthesis] - ... ["[1]/[0]" phase - ... ["[1]/[0]" extension] - ... ["[1]/[0]" analysis] - ... ... ["[1]/[0]" synthesis] - ... ]]] ... ["[1]/[0]" meta ... ["[1]/[0]" archive] ... ["[1]/[0]" cli] @@ -703,6 +692,132 @@ alias!))) ))) +(def locals_related + Test + (do [! random.monad] + [current_module (random.upper_cased 1) + [name_0 name_1 name_2 name_3 name_4] (|> (random.upper_cased 1) + (random.set text.hash 5) + (of ! each set.list) + (random.one (function (_ values) + (when values + (list name_0 name_1 name_2 name_3 name_4) + {.#Some [name_0 name_1 name_2 name_3 name_4]} + + _ + {.#None})))) + .let [type_0 {.#Nominal name_0 (list)} + type_1 {.#Nominal name_1 (list)} + type_2 {.#Nominal name_2 (list)} + type_3 {.#Nominal name_3 (list)} + type_4 {.#Nominal name_4 (list)} + + globals (is (List [Text [Bit .Global]]) + (list [name_4 + [false {.#Definition [type_4 []]}]])) + + scopes (list [.#scope_name (list) + .#inner_scopes 0 + .#locals [.#counter 1 + .#mappings (list [name_3 [type_3 3]])] + .#captured [.#counter 0 + .#mappings (list)]] + [.#scope_name (list) + .#inner_scopes 0 + .#locals [.#counter 2 + .#mappings (list [name_1 [type_1 1]] + [name_2 [type_2 2]])] + .#captured [.#counter 0 + .#mappings (list)]] + [.#scope_name (list) + .#inner_scopes 0 + .#locals [.#counter 1 + .#mappings (list [name_0 [type_0 0]])] + .#captured [.#counter 0 + .#mappings (list)]])] + .let [expected_lux + (is Lux + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes scopes + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []])]] + (all _.and + (_.coverage [.Scope /.locals] + (let [equivalence (is (Equivalence (List (List [Text Type]))) + (list.equivalence + (list.equivalence + (product.equivalence + text.equivalence + type.equivalence))))] + (|> /.locals + (/.result expected_lux) + (try#each (of equivalence = (list (list [name_3 type_3]) + (list [name_1 type_1] + [name_2 type_2])))) + (try.else false)))) + (_.coverage [/.var_type] + (and (|> (/.var_type name_0) + (/.result expected_lux) + (try#each (of type.equivalence = type_0)) + (try.else false)) + (|> (/.var_type name_1) + (/.result expected_lux) + (try#each (of type.equivalence = type_1)) + (try.else false)) + (|> (/.var_type name_2) + (/.result expected_lux) + (try#each (of type.equivalence = type_2)) + (try.else false)) + (|> (/.var_type name_3) + (/.result expected_lux) + (try#each (of type.equivalence = type_3)) + (try.else false)))) + (_.coverage [/.type] + (and (|> (/.type ["" name_0]) + (/.result expected_lux) + (try#each (of type.equivalence = type_0)) + (try.else false)) + (|> (/.type ["" name_1]) + (/.result expected_lux) + (try#each (of type.equivalence = type_1)) + (try.else false)) + (|> (/.type ["" name_2]) + (/.result expected_lux) + (try#each (of type.equivalence = type_2)) + (try.else false)) + (|> (/.type ["" name_3]) + (/.result expected_lux) + (try#each (of type.equivalence = type_3)) + (try.else false)) + (|> (/.type [current_module name_4]) + (/.result expected_lux) + (try#each (of type.equivalence = type_4)) + (try.else false)) + (|> (/.type ["" name_4]) + (/.result expected_lux) + (try#each (of type.equivalence = type_4)) + (try.else false)))) + ))) + ... (def label_related ... Test ... (do [! random.monad] @@ -842,132 +957,6 @@ ... ... ))))) ... ))) -... (def locals_related -... Test -... (do [! random.monad] -... [current_module (random.upper_cased 1) -... [name_0 name_1 name_2 name_3 name_4] (|> (random.upper_cased 1) -... (random.set text.hash 5) -... (of ! each set.list) -... (random.one (function (_ values) -... (when values -... (list name_0 name_1 name_2 name_3 name_4) -... {.#Some [name_0 name_1 name_2 name_3 name_4]} - -... _ -... {.#None})))) -... .let [type_0 {.#Nominal name_0 (list)} -... type_1 {.#Nominal name_1 (list)} -... type_2 {.#Nominal name_2 (list)} -... type_3 {.#Nominal name_3 (list)} -... type_4 {.#Nominal name_4 (list)} - -... globals (is (List [Text .Global]) -... (list [name_4 -... {.#Definition [false type_4 []]}])) - -... scopes (list [.#scope_name (list) -... .#inner_scopes 0 -... .#locals [.#counter 1 -... .#mappings (list [name_3 [type_3 3]])] -... .#captured [.#counter 0 -... .#mappings (list)]] -... [.#scope_name (list) -... .#inner_scopes 0 -... .#locals [.#counter 2 -... .#mappings (list [name_1 [type_1 1]] -... [name_2 [type_2 2]])] -... .#captured [.#counter 0 -... .#mappings (list)]] -... [.#scope_name (list) -... .#inner_scopes 0 -... .#locals [.#counter 1 -... .#mappings (list [name_0 [type_0 0]])] -... .#captured [.#counter 0 -... .#mappings (list)]])] -... .let [expected_lux -... (is Lux -... [.#info [.#target "" -... .#version "" -... .#mode {.#Build} -... .#configuration (list)] -... .#source [location.dummy 0 ""] -... .#location location.dummy -... .#current_module {.#Some current_module} -... .#modules (list [current_module -... [.#module_hash 0 -... .#module_aliases (list) -... .#definitions globals -... .#imports (list) -... .#module_state {.#Active}]]) -... .#scopes scopes -... .#type_context [.#ex_counter 0 -... .#var_counter 0 -... .#var_bindings (list)] -... .#expected {.#None} -... .#seed 0 -... .#scope_type_vars (list) -... .#extensions [] -... .#eval (as (-> Type Code (Meta Any)) []) -... .#host []])]] -... (all _.and -... (_.coverage [.Scope /.locals] -... (let [equivalence (is (Equivalence (List (List [Text Type]))) -... (list.equivalence -... (list.equivalence -... (product.equivalence -... text.equivalence -... type.equivalence))))] -... (|> /.locals -... (/.result expected_lux) -... (try#each (of equivalence = (list (list [name_3 type_3]) -... (list [name_1 type_1] -... [name_2 type_2])))) -... (try.else false)))) -... (_.coverage [/.var_type] -... (and (|> (/.var_type name_0) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_0)) -... (try.else false)) -... (|> (/.var_type name_1) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_1)) -... (try.else false)) -... (|> (/.var_type name_2) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_2)) -... (try.else false)) -... (|> (/.var_type name_3) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_3)) -... (try.else false)))) -... (_.coverage [/.type] -... (and (|> (/.type ["" name_0]) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_0)) -... (try.else false)) -... (|> (/.type ["" name_1]) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_1)) -... (try.else false)) -... (|> (/.type ["" name_2]) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_2)) -... (try.else false)) -... (|> (/.type ["" name_3]) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_3)) -... (try.else false)) -... (|> (/.type [current_module name_4]) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_4)) -... (try.else false)) -... (|> (/.type ["" name_4]) -... (/.result expected_lux) -... (try#each (of type.equivalence = type_4)) -... (try.else false)))) -... ))) - (def injection (Injection Meta) (of /.monad in)) @@ -1028,7 +1017,7 @@ (_.for [/.apply] (applyT.spec ..injection (..comparison expected_lux) /.apply)) (_.for [/.monad] - ($monad.spec ..injection (..comparison expected_lux) /.monad)) + (monadT.spec ..injection (..comparison expected_lux) /.monad)) (do random.monad [expected_value random.nat @@ -1056,13 +1045,13 @@ ..context_related ..definition_related ..search_related - ... ..locals_related + ..locals_related ... (_.for [.Label] ... ..label_related) )) /code.test - ... /location.test + /location.test ... /symbol.test ... /configuration.test ... /version.test @@ -1083,17 +1072,10 @@ /compiler.test ... /compiler/version.test ... /compiler/reference.test - ... /compiler/phase.test - ... /compiler/analysis.test - ... /compiler/synthesis.test ... /compiler/meta/archive.test ... /compiler/meta/cli.test ... /compiler/meta/export.test ... /compiler/meta/import.test ... /compiler/meta/context.test ... /compiler/meta/cache.test - ... /compiler/phase/extension.test - ... /compiler/phase/analysis.test - ... ... /compiler/syntax.test - ... ... /compiler/synthesis.test ))))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux.lux index ed26027df..0ff6e0b28 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux.lux @@ -34,7 +34,17 @@ [test ["_" property (.only Test)]]]] [\\library - ["[0]" /]]) + ["[0]" /]] + ["[0]" / + ... ["[1][0]" syntax] + ... ["[1][0]" analysis] + ... ["[1][0]" synthesis] + ["[1][0]" phase + ... ["[1][0]" extension] + ... ["[1][0]" analysis] + ... ["[1][0]" synthesis] + ] + ["[1][0]" translation]]) (def any_equivalence (Equivalence Any) @@ -125,4 +135,7 @@ [actual_module actual_short] (the signature.#name it)] (and (text#= expected_module actual_module))) (same? version.latest (the signature.#version it))))) + + /phase.test + /translation.test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux new file mode 100644 index 000000000..faf76b112 --- /dev/null +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux @@ -0,0 +1,210 @@ +(.require + [library + [lux (.except) + [abstract + ["[0]" monad (.only do) + ["[1]T" \\test]] + ["[0]" functor + ["[1]T" \\test (.only Injection Comparison)]]] + [control + ["[0]" pipe] + ["[0]" try (.use "[1]#[0]" functor)] + ["[0]" exception]] + [data + ["[0]" text (.use "[1]#[0]" equivalence) + ["%" \\format (.only format)]]] + [math + ["[0]" random] + [number + ["n" nat] + ["i" int]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [//// + [meta + ["[0]" archive]]]]]) + +(def (injection value) + (All (_ of) + (Injection (/.Operation of))) + (function (_ state) + {try.#Success [state value]})) + +(def (comparison init) + (All (_ of) + (-> of + (Comparison (/.Operation of)))) + (function (_ == left right) + (when [(/.result init left) + (/.result init right)] + [{try.#Success left} + {try.#Success right}] + (== left right) + + _ + false))) + +(exception.def oops) + +(def test|error + Test + (do [! random.monad] + [state random.nat + expected random.int + expected_error (random.lower_cased 1)] + (all _.and + (_.coverage [/.failure] + (|> (/.failure expected_error) + (/.result state) + (pipe.when {try.#Failure actual_error} + (same? expected_error actual_error) + + _ + false))) + (_.coverage [/.of_try] + (and (|> (/.of_try {try.#Failure expected_error}) + (/.result state) + (pipe.when {try.#Failure actual_error} + (same? expected_error actual_error) + + _ + false)) + (|> (/.of_try {try.#Success expected}) + (of /.functor each (same? expected)) + (/.result state) + (try.else false)))) + (_.coverage [/.except] + (|> (/.except ..oops []) + (/.result state) + (pipe.when {try.#Failure error} + (exception.match? ..oops error) + + _ + false))) + (_.coverage [/.assertion] + (and (|> (/.assertion ..oops [] false) + (/.result state) + (pipe.when {try.#Failure error} + (exception.match? ..oops error) + + _ + false)) + (|> (/.assertion ..oops [] true) + (/.result state) + (pipe.when {try.#Success _} + true + + _ + false)))) + ))) + +(def test|state + Test + (do [! random.monad] + [state random.nat + dummy random.nat + expected random.int] + (all _.and + (_.coverage [/.state] + (|> /.state + (of /.functor each (same? state)) + (/.result state) + (try.else false))) + (_.coverage [/.with] + (|> (do /.monad + [_ (/.with state)] + /.state) + (of /.functor each (same? state)) + (/.result dummy) + (try.else false))) + (_.coverage [/.sub] + (|> (/.sub [(of n.hex encoded) + (function (_ new old) + (|> new (of n.hex decoded) (try.else dummy)))] + (do /.monad + [state/hex /.state] + (in (|> state + (of n.hex encoded) + (text#= state/hex))))) + (/.result' state) + (pipe.when {try.#Success [state' verdict]} + (and verdict + (n.= state state')) + + _ + false))) + ))) + +(def test|operation + Test + (do [! random.monad] + [state random.nat + expected random.int] + (all _.and + (_.for [/.functor] + (functorT.spec ..injection (..comparison state) /.functor)) + (_.for [/.monad] + (monadT.spec ..injection (..comparison state) /.monad)) + + (_.coverage [/.result] + (|> (of /.monad in expected) + (/.result state) + (pipe.when {try.#Success actual} + (same? expected actual) + + _ + false))) + (_.coverage [/.result'] + (|> (of /.monad in expected) + (/.result' state) + (pipe.when {try.#Success [state' actual]} + (and (same? state state') + (same? expected actual)) + + _ + false))) + ..test|state + ..test|error + ))) + +(def test|phase + Test + (do [! random.monad] + [state/0 random.nat + state/1 random.rev + expected random.int] + (all _.and + (_.coverage [/.identity] + (|> (/.identity archive.empty expected) + (/.result state/0) + (try#each (same? expected)) + (try.else false))) + (_.coverage [/.composite] + (let [phase (/.composite (is (/.Phase Nat Int Frac) + (function (_ archive input) + (of /.monad in (i.frac input)))) + (is (/.Phase Rev Frac Text) + (function (_ archive input) + (of /.monad in (%.frac input)))))] + (|> (phase archive.empty expected) + (/.result' [state/0 state/1]) + (pipe.when {try.#Success [[state/0' state/1'] actual]} + (and (text#= (%.frac (i.frac expected)) actual) + (same? state/0 state/0') + (same? state/1 state/1')) + + _ + false)))) + ))) + +(def .public test + Test + (<| (_.covering /._) + (all _.and + (_.for [/.Operation] + ..test|operation) + (_.for [/.Phase] + ..test|phase) + ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/translation.lux b/stdlib/source/test/lux/meta/compiler/language/lux/translation.lux new file mode 100644 index 000000000..8df8dbcbe --- /dev/null +++ b/stdlib/source/test/lux/meta/compiler/language/lux/translation.lux @@ -0,0 +1,76 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [control + ["[0]" try]] + [data + [collection + ["[0]" list] + ["[0]" sequence]]] + [math + ["[0]" random (.only Random)] + [number + ["n" nat]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [//// + [meta + [archive + ["[0]" registry]]]]]]) + +(def dummy_host + (/.Host Any Any) + (implementation + (def (evaluate _ _) + {try.#Failure ""}) + (def (execute _) + {try.#Failure ""}) + (def (define _ _ _) + {try.#Failure ""}) + + (def (ingest _ _) + []) + (def (re_learn _ _ _) + {try.#Failure ""}) + (def (re_load _ _ _) + {try.#Failure ""}))) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_module (random.lower_cased 1)]) + (all _.and + (_.coverage [/.Host] + true) + (_.coverage [/.Operation /.Phase] + true) + (_.for [/.State + /.#module /.#anchor /.#host /.#buffer + /.#registry /.#registry_shift + /.#counter /.#context /.#log /.#interim_artifacts] + (all _.and + (_.coverage [/.state] + (let [it (is (/.State Any Any Any) + (/.state ..dummy_host expected_module))] + (and (same? expected_module (the /.#module it)) + (when (the /.#anchor it) {.#None} true _ false) + (same? ..dummy_host (the /.#host it)) + (when (the /.#buffer it) {.#None} true _ false) + (same? registry.empty (the /.#registry it)) + (n.= 0 (the /.#registry_shift it)) + (n.= 0 (the /.#counter it)) + (when (the /.#context it) {.#None} true _ false) + (sequence.empty? (the /.#log it)) + (list.empty? (the /.#interim_artifacts it))))) + )) + (_.for [/.Buffer] + (all _.and + (_.coverage [/.empty_buffer] + (sequence.empty? /.empty_buffer)) + )) + ))) diff --git a/stdlib/source/test/lux/meta/compiler/phase.lux b/stdlib/source/test/lux/meta/compiler/phase.lux deleted file mode 100644 index 692058872..000000000 --- a/stdlib/source/test/lux/meta/compiler/phase.lux +++ /dev/null @@ -1,208 +0,0 @@ -(.require - [library - [lux (.except) - [abstract - [monad (.only do)] - ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]] - [\\specification - ["$[0]" monad]]] - [control - ["[0]" pipe] - ["[0]" try (.use "[1]#[0]" functor)] - ["[0]" exception]] - [data - ["[0]" text (.use "[1]#[0]" equivalence) - ["%" \\format (.only format)]]] - [math - ["[0]" random] - [number - ["n" nat] - ["i" int]]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only) - [// - [meta - ["[0]" archive]]]]]) - -(def (injection value) - (All (_ s) (Injection (/.Operation s))) - (function (_ state) - {try.#Success [state value]})) - -(def (comparison init) - (All (_ s) (-> s (Comparison (/.Operation s)))) - (function (_ == left right) - (when [(/.result init left) - (/.result init right)] - [{try.#Success left} - {try.#Success right}] - (== left right) - - _ - false))) - -(exception.def oops) - -(def test|error - Test - (do [! random.monad] - [state random.nat - expected random.int - expected_error (random.lower_cased 1)] - (all _.and - (_.coverage [/.failure] - (|> (/.failure expected_error) - (/.result state) - (pipe.when {try.#Failure actual_error} - (same? expected_error actual_error) - - _ - false))) - (_.coverage [/.of_try] - (and (|> (/.of_try {try.#Failure expected_error}) - (/.result state) - (pipe.when {try.#Failure actual_error} - (same? expected_error actual_error) - - _ - false)) - (|> (/.of_try {try.#Success expected}) - (of /.functor each (same? expected)) - (/.result state) - (try.else false)))) - (_.coverage [/.except] - (|> (/.except ..oops []) - (/.result state) - (pipe.when {try.#Failure error} - (exception.match? ..oops error) - - _ - false))) - (_.coverage [/.assertion] - (and (|> (/.assertion ..oops [] false) - (/.result state) - (pipe.when {try.#Failure error} - (exception.match? ..oops error) - - _ - false)) - (|> (/.assertion ..oops [] true) - (/.result state) - (pipe.when {try.#Success _} - true - - _ - false)))) - ))) - -(def test|state - Test - (do [! random.monad] - [state random.nat - dummy random.nat - expected random.int] - (all _.and - (_.coverage [/.state] - (|> /.state - (of /.functor each (same? state)) - (/.result state) - (try.else false))) - (_.coverage [/.with] - (|> (do /.monad - [_ (/.with state)] - /.state) - (of /.functor each (same? state)) - (/.result dummy) - (try.else false))) - (_.coverage [/.sub] - (|> (/.sub [(of n.hex encoded) - (function (_ new old) - (|> new (of n.hex decoded) (try.else dummy)))] - (do /.monad - [state/hex /.state] - (in (|> state - (of n.hex encoded) - (text#= state/hex))))) - (/.result' state) - (pipe.when {try.#Success [state' verdict]} - (and verdict - (n.= state state')) - - _ - false))) - ))) - -(def test|operation - Test - (do [! random.monad] - [state random.nat - expected random.int] - (all _.and - (_.for [/.functor] - (functorT.spec ..injection (..comparison state) /.functor)) - (_.for [/.monad] - ($monad.spec ..injection (..comparison state) /.monad)) - - (_.coverage [/.result] - (|> (of /.monad in expected) - (/.result state) - (pipe.when {try.#Success actual} - (same? expected actual) - - _ - false))) - (_.coverage [/.result'] - (|> (of /.monad in expected) - (/.result' state) - (pipe.when {try.#Success [state' actual]} - (and (same? state state') - (same? expected actual)) - - _ - false))) - ..test|state - ..test|error - ))) - -(def test|phase - Test - (do [! random.monad] - [state/0 random.nat - state/1 random.rev - expected random.int] - (all _.and - (_.coverage [/.identity] - (|> (/.identity archive.empty expected) - (/.result state/0) - (try#each (same? expected)) - (try.else false))) - (_.coverage [/.composite] - (let [phase (/.composite (is (/.Phase Nat Int Frac) - (function (_ archive input) - (of /.monad in (i.frac input)))) - (is (/.Phase Rev Frac Text) - (function (_ archive input) - (of /.monad in (%.frac input)))))] - (|> (phase archive.empty expected) - (/.result' [state/0 state/1]) - (pipe.when {try.#Success [[state/0' state/1'] actual]} - (and (text#= (%.frac (i.frac expected)) actual) - (same? state/0 state/0') - (same? state/1 state/1')) - - _ - false)))) - ))) - -(def .public test - Test - (<| (_.covering /._) - (all _.and - (_.for [/.Operation] - ..test|operation) - (_.for [/.Phase] - ..test|phase) - ))) diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index 18aef928a..bd41c0de7 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -2,13 +2,12 @@ [library [lux (.except symbol type) [abstract - ["[0]" monad (.only do)] + ["[0]" monad (.only do) + ["[1]T" \\test]] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] ["[0]" apply - ["[1]T" \\test]] - [\\specification - ["$[0]" monad]]] + ["[1]T" \\test]]] [control ["[0]" pipe] ["[0]" function] @@ -117,7 +116,7 @@ (_.for [/.apply] (applyT.spec ..injection ..comparison /.apply)) (_.for [/.monad] - ($monad.spec ..injection ..comparison /.monad)) + (monadT.spec ..injection ..comparison /.monad)) )) (def (nominal_type parameters) diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux index e4f9f5cec..2832e94be 100644 --- a/stdlib/source/test/lux/world.lux +++ b/stdlib/source/test/lux/world.lux @@ -20,7 +20,8 @@ ["[1]/[0]" market ["[1]/[0]" price] ["[1]/[0]" analysis - ["[1]/[0]" accumulation_distribution]]]] + ["[1]/[0]" accumulation_distribution] + ["[1]/[0]" pivot_point]]]] ["[1][0]" net] ["[1][0]" time] ["[1][0]" locale] @@ -41,6 +42,7 @@ /finance/trade/session.test /finance/market/price.test /finance/market/analysis/accumulation_distribution.test + /finance/market/analysis/pivot_point.test /net.test /time.test diff --git a/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux index 74b502140..15b8fa6a6 100644 --- a/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux +++ b/stdlib/source/test/lux/world/finance/market/analysis/accumulation_distribution.lux @@ -22,7 +22,7 @@ Test (<| (_.covering /._) (do [! random.monad] - [session (sessionT.random currency.usd)]) + [session (sessionT.random currency.usd 1000,00)]) (all _.and (_.coverage [/.oscillation] (let [it (/.oscillation session)] diff --git a/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux new file mode 100644 index 000000000..bb7cd12b3 --- /dev/null +++ b/stdlib/source/test/lux/world/finance/market/analysis/pivot_point.lux @@ -0,0 +1,40 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [math + ["[0]" random (.only Random)]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [//// + ["[0]" money (.only) + ["[0]" currency]] + [trade + ["[0]" session (.only) + ["[1]T" \\test]]]]]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [session (sessionT.random currency.usd 1000,00)]) + (all _.and + (_.coverage [/.typical_price] + (let [it (/.typical_price session)] + (and (money.<= (the session.#high session) + it) + (money.>= (the session.#low session) + it)))) + (_.coverage [/.Central_Pivot_Range /.central_pivot_range + /.#pivot_point /.#top_central /.#bottom_central] + (let [it (/.central_pivot_range session)] + (and (money.= (/.typical_price session) + (the /.#pivot_point it)) + (money.< (the /.#top_central it) + (the /.#pivot_point it)) + (money.> (the /.#bottom_central it) + (the /.#pivot_point it))))) + ))) diff --git a/stdlib/source/test/lux/world/finance/money.lux b/stdlib/source/test/lux/world/finance/money.lux index 073f19f34..dd5108cac 100644 --- a/stdlib/source/test/lux/world/finance/money.lux +++ b/stdlib/source/test/lux/world/finance/money.lux @@ -14,7 +14,7 @@ ["[0]" text (.only) ["%" \\format]]] [math - ["[0]" random (.only Random) (.use "[1]#[0]" functor)] + ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["n" nat]]] [test @@ -25,12 +25,15 @@ ["[0]" / ["[1][0]" currency]]) -(def .public (random $) +(def .public (random $ max_sub_units) (All (_ $) - (-> (Currency $) + (-> (Currency $) Nat (Random (/.Money $)))) - (random#each (/.money $) - random.nat)) + (when max_sub_units + 0 (random#in (/.money $ max_sub_units)) + _ (random#each (|>> (n.% max_sub_units) + (/.money $)) + random.nat))) (def .public test Test @@ -43,9 +46,9 @@ (_.for [/.Money]) (all _.and (_.for [/.equivalence /.=] - (equivalenceS.spec /.equivalence (..random currency.usd))) + (equivalenceS.spec /.equivalence (..random currency.usd 1000,00))) (_.for [/.order /.<] - (orderT.spec /.order (..random currency.usd))) + (orderT.spec /.order (..random currency.usd 1000,00))) (_.coverage [/.money /.currency /.amount] (let [it (/.money currency.usd expected_amount)] @@ -98,7 +101,7 @@ (/.of_sub_units currency.usd (/.sub_units expected)))] (/.= expected actual))) (do ! - [it (..random currency.usd)] + [it (..random currency.usd 1000,00)] (_.coverage [/.format] (and (text.starts_with? (%.nat (/.amount it)) (text.replaced_once "." "" (/.format it))) diff --git a/stdlib/source/test/lux/world/finance/trade/session.lux b/stdlib/source/test/lux/world/finance/trade/session.lux index 7519d63e3..70dde1b44 100644 --- a/stdlib/source/test/lux/world/finance/trade/session.lux +++ b/stdlib/source/test/lux/world/finance/trade/session.lux @@ -24,15 +24,15 @@ [/// ["[0]T" money]]) -(def .public (random $) +(def .public (random $ max_sub_units) (All (_ $) - (-> (Currency $) + (-> (Currency $) Nat (Random (/.Session $)))) (do random.monad - [p0 (moneyT.random $) - p1 (moneyT.random $) - p2 (moneyT.random $) - p3 (moneyT.random $) + [p0 (moneyT.random $ max_sub_units) + p1 (moneyT.random $ max_sub_units) + p2 (moneyT.random $ max_sub_units) + p3 (moneyT.random $ max_sub_units) bullish? random.bit volume random.nat] (when (list.sorted money.< (list p0 p1 p2 p3)) @@ -54,13 +54,13 @@ Test (<| (_.covering /._) (do [! random.monad] - [before (..random currency.usd) - after (..random currency.usd)]) + [before (..random currency.usd 1000,00) + after (..random currency.usd 1000,00)]) (_.for [/.Session /.Volume /.#open /.#high /.#low /.#close /.#volume]) (all _.and (_.for [/.equivalence] - (equivalenceS.spec /.equivalence (..random currency.usd))) + (equivalenceS.spec /.equivalence (..random currency.usd 1000,00))) (_.coverage [/.composite] (let [both (/.composite before after)] -- cgit v1.2.3