Skip to content

Commit

Permalink
Adapting to new List type (part 2).
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Mar 6, 2024
1 parent eeebece commit a02af15
Show file tree
Hide file tree
Showing 244 changed files with 2,622 additions and 2,159 deletions.
2 changes: 1 addition & 1 deletion lux-cl/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
["[0]" ffi]
["[0]" debug]
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[control
["[0]" pipe]
["[0]" maybe]
Expand Down
4 changes: 2 additions & 2 deletions lux-lua/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[program (.only program)]
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[control
["[0]" maybe]
["[0]" io (.only IO io)]]
Expand Down Expand Up @@ -290,7 +290,7 @@
(-> (-> Any java/lang/Object) net/sandius/rembulan/runtime/LuaFunction (Stack java/lang/Object) Any Any)
(<| try.trusted
(do [! try.monad]
[input/* (monad.each ! ..read parameters)]
[input/* (stack.each' ! ..read parameters)]
(loop (again [lux_function abstraction
input/* input/*])
(`` (`` (when input/*
Expand Down
2 changes: 1 addition & 1 deletion lux-php/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
["[0]" ffi]
["[0]" debug]
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[concurrency
["[0]" future (.only Future)]]
[control
Expand Down
4 changes: 2 additions & 2 deletions lux-python/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
["[0]" ffi (.only import)]
["[0]" debug]
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[concurrency
["[0]" future (.only Future)]]
[control
Expand Down Expand Up @@ -274,7 +274,7 @@
org/python/core/PyObject
(try.trusted
(do [! try.monad]
[inputs (monad.each ! ..read (array.stack {.#None} inputs))]
[inputs (stack.each' ! ..read (array.stack {.#None} inputs))]
(in (loop (again [it it
inputs inputs])
(`` (`` (when inputs
Expand Down
2 changes: 1 addition & 1 deletion lux-r/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
["[0]" ffi]
["[0]" debug]
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[concurrency
["[0]" future (.only Future)]]
[control
Expand Down
12 changes: 6 additions & 6 deletions lux-ruby/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
["[0]" debug]
["[0]" ffi (.only import)]
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[concurrency
["[0]" future (.only Future)]]
[control
["[0]" maybe]
["[0]" io (.only IO io)]]
[error
["[0]" try (.only Try)]
["[0]" exception (.only Exception)]]
[error
["[0]" try (.only Try)]
["[0]" exception (.only Exception)]]
[data
["[0]" text (.use "[1]#[0]" hash)
["%" \\injection]
Expand Down Expand Up @@ -404,7 +404,7 @@
stack.indices
(stack#each (function (_ index)
(ffi.read! index args)))
(monad.each ! (|>> (ffi.is java/lang/Object) ..read)))
(stack.each' ! (|>> (ffi.is java/lang/Object) ..read)))
output (when args
(stack arg/0)
(in ((as (-> Any java/lang/Object) value)
Expand Down Expand Up @@ -862,7 +862,7 @@
(do [! try.monad]
[inputs (|> inputs
(array.stack {.#None})
(monad.each ! (|>> (ffi.is java/lang/Object) ..read)))])
(stack.each' ! (|>> (ffi.is java/lang/Object) ..read)))])
(when inputs
... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value.
(stack info source provenance current_module modules scopes type_context expected seed scope_type_vars extensions eval host)
Expand Down
65 changes: 0 additions & 65 deletions stdlib/source/library/lux/abstract/monad.lux
Original file line number Diff line number Diff line change
Expand Up @@ -135,71 +135,6 @@
(|>> (by monad each f)
(by monad conjoint)))

(the .public (all monad)
(for_any (_ ! it)
(-> (Monad !) (Stack (! it))
(! (Stack it))))
(let [(open "/#[0]") monad]
(function (again xs)
(when xs
{.#Empty}
(/#in {.#Empty})

{.#Top x xs'}
(|> x
(/#each (function (_ _x)
(/#each (|>> {.#Top _x}) (again xs'))))
/#conjoint)))))

(the .public (each monad f)
(for_any (_ ! before after)
(-> (Monad !) (-> before (! after)) (Stack before)
(! (Stack after))))
(let [(open "/#[0]") monad]
(function (again xs)
(when xs
{.#Empty}
(/#in {.#Empty})

{.#Top x xs'}
(|> (f x)
(/#each (function (_ _x)
(/#each (|>> {.#Top _x}) (again xs'))))
/#conjoint)))))

(the .public (only monad f)
(for_any (_ ! it)
(-> (Monad !) (-> it (! Bit)) (Stack it)
(! (Stack it))))
(let [(open "/#[0]") monad]
(function (again xs)
(when xs
{.#Empty}
(/#in {.#Empty})

{.#Top head xs'}
(|> (f head)
(/#each (function (_ verdict)
(/#each (function (_ tail)
(if verdict
{.#Top head tail}
tail))
(again xs'))))
/#conjoint)))))

(the .public (mix monad f init xs)
(for_any (_ ! part whole)
(-> (Monad !) (-> part whole (! whole)) whole (Stack part)
(! whole)))
(when xs
{.#Empty}
(by monad in init)

{.#Top x xs'}
(do monad
[init' (f x init)]
(mix monad f init' xs'))))

(the .public deferred
(macro (_ tokens)
(when tokens
Expand Down
42 changes: 21 additions & 21 deletions stdlib/source/library/lux/compiler/default/init.lux
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[library
[lux (.except)
[abstract
["[0]" monad (.only do)]]
[monad (.only do)]]
[error
["[0]" try (.only Try)]
["[0]" exception]]
Expand Down Expand Up @@ -109,10 +109,10 @@
(do [! phase.monad]
[_ (|> bundle
dictionary.entries
(monad.each !
(function (_ [name handler])
(///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Analysis handler]}])))))]
(stack.each' !
(function (_ [name handler])
(///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Analysis handler]}])))))]
(in [])))

(the (with_synthesis_defaults bundle)
Expand All @@ -121,10 +121,10 @@
(do [! phase.monad]
[_ (|> bundle
dictionary.entries
(monad.each !
(function (_ [name handler])
(///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Synthesis handler]}])))))]
(stack.each' !
(function (_ [name handler])
(///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Synthesis handler]}])))))]
(in [])))

(the (with_translation_defaults bundle)
Expand All @@ -134,10 +134,10 @@
(do [! phase.monad]
[_ (|> bundle
dictionary.entries
(monad.each !
(function (_ [name handler])
(///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Translation handler]}])))))]
(stack.each' !
(function (_ [name handler])
(///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Translation handler]}])))))]
(in [])))

(the (with_declaration_defaults bundle)
Expand All @@ -147,12 +147,12 @@
(do [! phase.monad]
[_ (|> bundle
dictionary.entries
(monad.each !
(function (_ [name handler])
(do !
[_ (///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Declaration handler]}]))]
(in [])))))]
(stack.each' !
(function (_ [name handler])
(do !
[_ (///declaration.of_analysis
(moduleA.override_definition [.prelude name] [true {.#Default [.Declaration handler]}]))]
(in [])))))]
(in [])))

(every .public (Extensions anchor expression declaration)
Expand Down Expand Up @@ -192,7 +192,7 @@
_ (with_defaults module all_extensions)]
(///declaration.of_analysis
(do [! phase.monad]
[_ (monad.each ! moduleA.import dependencies)
[_ (stack.each' ! moduleA.import dependencies)
.let [source (///analysis.source (its ///.#module input) (its ///.#code input))]
_ (///analysis.set_source_code source)]
(in [source [///translation.empty_buffer
Expand Down Expand Up @@ -370,7 +370,7 @@
(///translation.set_registry temporary_registry))
_ (|> requirements
(its ///declaration.#referrals)
(monad.each ! (execute! archive)))
(stack.each' ! (execute! archive)))
temporary_payload (..get_current_payload extender)]
(..iteration wrapper archive extender expander module source temporary_payload (..module_aliases analysis_module))))))]}]))
)))))])))))
Expand Down
27 changes: 13 additions & 14 deletions stdlib/source/library/lux/compiler/default/platform.lux
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#host)
["[0]" debug]
[abstract
["[0]" monad (.only Monad
do)]]
[monad (.only Monad do)]]
[concurrency
["[0]" future (.only Future Resolver) (.use "[1]#[0]" monad)]
["[0]" stm (.only Var STM)]]
Expand Down Expand Up @@ -131,12 +130,12 @@
(its archive.#output)
sequence.as_stack
(stack.sub 128)
(monad.each ! (monad.each ! write_artifact!))
(stack.each' ! (stack.each' ! write_artifact!))
(is (Action (Stack (Stack Any)))))
(|> entry
(its archive.#output)
sequence.as_stack
(monad.each ..monad write_artifact!)
(stack.each' ..monad write_artifact!)
(is (Action (Stack Any)))))
document (by future.monad in
(document.marked? key (its [archive.#module moduleM.#document] entry)))]
Expand Down Expand Up @@ -487,14 +486,14 @@
(-> Archive (Stack <State>) <State>
(Try <State>)))
(do [! try.monad]
[modules (monad.each ! (function (_ module)
(do !
[entry (archive.find module archive)
lux_module (|> entry
(its [archive.#module moduleM.#document])
(document.content $.key))]
(in [module lux_module])))
(archive.archived archive))
[modules (stack.each' ! (function (_ module)
(do !
[entry (archive.find module archive)
lux_module (|> entry
(its [archive.#module moduleM.#document])
(document.content $.key))]
(in [module lux_module])))
(archive.archived archive))
.let [additions (|> modules
(stack#each product.left)
(set.of_stack text.hash))
Expand Down Expand Up @@ -561,7 +560,7 @@
(do [! future.monad]
[attempts (|> new_dependencies
(stack#each (import! customs module))
(monad.all !))
(stack.all' !))
.let [[failures successes] (sum.partition attempts)]]
(in {try.#Success [(|> successes
(stack#each product.left)
Expand Down Expand Up @@ -802,6 +801,6 @@
(future#in (|> custom
lux_compiler
(function.on parameters))))))
(monad.all !))]
(stack.all' !))]
(import! customs descriptor.runtime program_module))))
)))))
29 changes: 29 additions & 0 deletions stdlib/source/library/lux/compiler/extension.lux
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.using
[library
[lux (.except Name name)
[data
["[0]" text]]]])

(the suffix
"#")

(every .public Name
Text)

(the .public name
(-> Text
Name)
(text.suffix ..suffix))

(the .public synthesis
(-> Name
Name)
(text.suffix "|synthesis"))

(the .public translation
(-> Name
Name)
(text.suffix "|translation"))
19 changes: 19 additions & 0 deletions stdlib/source/library/lux/compiler/extension/lux.lux
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.using
[library
[lux (.except list)
[macro
["[0]" template]]]]
["[0]" //])

(template.with [,name]
[(the .public ,name
//.Name
(let [[_ proper] (name ,name)]
(//.name proper)))]

[list]
[text_composite]
)
4 changes: 2 additions & 2 deletions stdlib/source/library/lux/compiler/language/lux/analysis.lux
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
(every .public (Reification c)
[c (List c)])

(the .public no_op
(template.macro (no_op @ value)
(the .public coercion
(template.macro (_ @ value)
[(|> 1
{variable.#Local}
{reference.#Variable}
Expand Down
Loading

0 comments on commit a02af15

Please sign in to comment.