diff options
author | Eduardo Julian | 2022-12-22 17:21:26 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-12-22 17:21:26 -0400 |
commit | 6f1bf11af05bd03183fee7721ac99eca826ca041 (patch) | |
tree | 9661fdef01ebb7e4c1ead05e839d608bfab86217 /stdlib/source/library | |
parent | 4f4a96635abb04239102e4b72dc2a9c6f678dcd2 (diff) |
Added some explicit machinery for the Any type.
Diffstat (limited to 'stdlib/source/library')
7 files changed, 59 insertions, 24 deletions
diff --git a/stdlib/source/library/lux/data/any.lux b/stdlib/source/library/lux/data/any.lux new file mode 100644 index 000000000..1e5c6591f --- /dev/null +++ b/stdlib/source/library/lux/data/any.lux @@ -0,0 +1,25 @@ +(.require + [library + [lux (.except) + [abstract + [equivalence (.only Equivalence)] + [hash (.only Hash)]]]]) + +(def .public any + Any + []) + +(def .public equivalence + (Equivalence Any) + (implementation + (def (= _ _) + true))) + +(def .public hash + (Hash Any) + (implementation + (def equivalence + ..equivalence) + + (def (hash _) + 1))) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux index 770614d0c..a3ca297a4 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm.lux @@ -55,7 +55,8 @@ it)))) (def .public (translate extender lux) - (-> extension.Extender Lux Phase) + (-> extension.Extender Lux + Phase) (function (phase archive synthesis) (when synthesis (^.with_template [<tag> <translator>] diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux index b0273f3f3..297504638 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/runtime.lux @@ -57,7 +57,6 @@ [reference [variable (.only Register)]] [meta - [io (.only lux_context)] [archive (.only Output Archive) ["[0]" artifact] ["[0]" registry (.only Registry)] @@ -97,7 +96,7 @@ (def .public (class_name [module id]) (-> unit.ID Text) - (format lux_context + (format "lux" "." (%.nat version.latest) "." (%.nat module) "." (%.nat id))) diff --git a/stdlib/source/library/lux/meta/compiler/meta/io.lux b/stdlib/source/library/lux/meta/compiler/meta/io.lux index 15184122b..5231403a3 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/io.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/io.lux @@ -4,18 +4,21 @@ [data ["[0]" text]] [world - [file (.only Path System)]]]]) + ["[0]" file]]]] + [// + [archive + [module + ["[0]" descriptor]]]]) (type .public Context - Path) + file.Path) (type .public Code Text) -(def .public (safe system) - (All (_ m) (-> (System m) Text Text)) - (text.replaced "/" (of system separator))) - -(def .public lux_context - Context - "lux") +(def .public (path fs) + (All (_ !) + (-> (file.System !) descriptor.Module + file.Path)) + (text.replaced .module_separator + (of fs separator))) diff --git a/stdlib/source/library/lux/meta/compiler/meta/io/context.lux b/stdlib/source/library/lux/meta/compiler/meta/io/context.lux index ab6322718..471ffe6f0 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/io/context.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Module Code) + [lux (.except Module) [abstract ["[0]" monad (.only Monad do)]] [control @@ -24,7 +24,7 @@ ["@" target]] [world ["[0]" file]]]] - ["[0]" // (.only Context Code) + ["[0]" // (.only Context) ["/[1]" // [import (.only Import)] ["/[1]" // (.only Input)] @@ -53,7 +53,7 @@ (def .public (path fs context module) (All (_ m) (-> (file.System m) Context Module file.Path)) (|> module - (//.safe fs) + (//.path fs) (format context (of fs separator)))) (def (find_source_file fs importer contexts module extension) diff --git a/stdlib/source/library/lux/world/finance/market/analysis.lux b/stdlib/source/library/lux/world/finance/market/analysis.lux new file mode 100644 index 000000000..a1861eea1 --- /dev/null +++ b/stdlib/source/library/lux/world/finance/market/analysis.lux @@ -0,0 +1,10 @@ +(.require + [library + [lux (.except Analysis) + [world + [time + [series (.only Series)]]]]]) + +(type .public (Analysis from to) + (-> (Series from) + (Series to))) 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 index 8b0693abb..7f4a6ca51 100644 --- a/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux +++ b/stdlib/source/library/lux/world/finance/market/analysis/pivot_point.lux @@ -9,12 +9,13 @@ [world [time ["[0]" series (.only Series) (.use "[1]#[0]" functor)]]]]] - [/// - [price (.only Price)] + [// (.only Analysis) [// - ["[0]" money] - [trade - ["[0]" session (.only Session)]]]]) + [price (.only Price)] + [// + ["[0]" money] + [trade + ["[0]" session (.only Session)]]]]]) ... https://en.wikipedia.org/wiki/Typical_price (def .public (typical_price it) @@ -68,10 +69,6 @@ #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 $))) |