aboutsummaryrefslogtreecommitdiff
path: root/lux-lua
diff options
context:
space:
mode:
Diffstat (limited to 'lux-lua')
-rw-r--r--lux-lua/source/program.lux76
1 files changed, 38 insertions, 38 deletions
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index 6eb8d8485..083c8ca0c 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -170,7 +170,7 @@
(let [re_wrap (function (_ unwrapped)
(case (ffi.check [java/lang/Object] unwrapped)
(#.Some sub_value)
- (|> sub_value (:coerce (Array java/lang/Object)) lux_structure (:coerce java/lang/Object))
+ (|> sub_value (:as (Array java/lang/Object)) lux_structure (:as java/lang/Object))
#.None
unwrapped))]
@@ -179,15 +179,15 @@
## Methods
(program/StructureValue
[] (getValue self) java/lang/Object
- (:coerce (Array java/lang/Object) value))
+ (:as (Array java/lang/Object) value))
(net/sandius/rembulan/impl/DefaultTable
[] (rawlen self) long
- (|> value array.size (:coerce java/lang/Long)))
+ (|> value array.size (:as java/lang/Long)))
(net/sandius/rembulan/impl/DefaultTable
[] (rawget self {idx long}) java/lang/Object
- (|> value (array.read (|> idx (:coerce Nat) dec)) maybe.assume re_wrap))
+ (|> value (array.read (|> idx (:as Nat) dec)) maybe.assume re_wrap))
(net/sandius/rembulan/impl/DefaultTable
[] (rawget self {field java/lang/Object}) java/lang/Object
@@ -214,7 +214,7 @@
#.None
(case (ffi.check java/lang/Long field)
(#.Some idx)
- (|> value (array.read (|> idx (:coerce Nat) dec)) maybe.assume re_wrap)
+ (|> value (array.read (|> idx (:as Nat) dec)) maybe.assume re_wrap)
#.None
(error! (exception.construct ..unknown_kind_of_object field)))))
@@ -231,7 +231,7 @@
(^multi [(#.Some tag) ?flag (#.Some value)]
[(read value)
(#.Some value)])
- (#try.Success [(java/lang/Long::intValue (:coerce java/lang/Long tag))
+ (#try.Success [(java/lang/Long::intValue (:as java/lang/Long tag))
(: Any (case ?flag (#.Some _) "" #.None (ffi.null)))
value])
@@ -246,14 +246,14 @@
output (: (Array java/lang/Object)
(array.new init_num_keys))]
(if (n.< num_keys idx)
- (case (net/sandius/rembulan/Table::get_idx (:coerce java/lang/Long (inc idx)) host_object)
+ (case (net/sandius/rembulan/Table::get_idx (:as java/lang/Long (inc idx)) host_object)
#.None
(recur num_keys (inc idx) output)
(#.Some member)
(case (read member)
(#try.Success parsed_member)
- (recur num_keys (inc idx) (array.write! idx (:coerce java/lang/Object parsed_member) output))
+ (recur num_keys (inc idx) (array.write! idx (:as java/lang/Object parsed_member) output))
(#try.Failure error)
(#try.Failure error)))
@@ -299,7 +299,7 @@
(def: ensure_function
(-> Macro (Maybe net/sandius/rembulan/runtime/LuaFunction))
- (|>> (:coerce java/lang/Object) (ffi.check net/sandius/rembulan/runtime/LuaFunction)))
+ (|>> (:as java/lang/Object) (ffi.check net/sandius/rembulan/runtime/LuaFunction)))
(type: Baggage
[net/sandius/rembulan/StateContext
@@ -309,16 +309,16 @@
(-> Baggage (List Code) Lux net/sandius/rembulan/runtime/LuaFunction (Try Any))
(do try.monad
[output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context
- (:coerce java/lang/Object macro)
+ (:as java/lang/Object macro)
(|> (array.new 2)
- (array.write! 0 ## (:coerce java/lang/Object inputs)
+ (array.write! 0 ## (:as java/lang/Object inputs)
## (net/sandius/rembulan/impl/ImmutableTable$Builder::build (net/sandius/rembulan/impl/ImmutableTable$Builder::new))
- (:coerce java/lang/Object (lux_structure (:coerce (Array java/lang/Object) inputs))))
- (array.write! 1 ## (:coerce java/lang/Object lux)
+ (:as java/lang/Object (lux_structure (:as (Array java/lang/Object) inputs))))
+ (array.write! 1 ## (:as java/lang/Object lux)
## (net/sandius/rembulan/impl/ImmutableTable$Builder::build (net/sandius/rembulan/impl/ImmutableTable$Builder::new))
- (:coerce java/lang/Object (lux_structure (:coerce (Array java/lang/Object) lux)))))
+ (:as java/lang/Object (lux_structure (:as (Array java/lang/Object) lux)))))
executor)]
- (|> output (array.read 0) maybe.assume (:coerce java/lang/Object) ..read)))
+ (|> output (array.read 0) maybe.assume (:as java/lang/Object) ..read)))
(def: (expander baggage macro inputs lux)
(-> Baggage Expander)
@@ -327,19 +327,19 @@
(case (..call_macro baggage inputs lux macro)
(#try.Success output)
(|> output
- (:coerce (Try [Lux (List Code)]))
+ (:as (Try [Lux (List Code)]))
#try.Success)
(#try.Failure error)
(#try.Failure error))
#.None
- (exception.throw ..cannot_apply_a_non_function (:coerce java/lang/Object macro)))))
+ (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro)))))
@.lua
(def: (expander macro inputs lux)
Expander
- (#try.Success ((:coerce Macro' macro) inputs lux)))})
+ (#try.Success ((:as Macro' macro) inputs lux)))})
(for {@.old (as_is (with_expansions [$var_args (_.var "...")
$str_rel_to_abs (_.var "_utf8_str_rel_to_abs")
@@ -543,7 +543,7 @@
(function (_ code)
(do try.monad
[lua_function (net/sandius/rembulan/load/ChunkLoader::loadTextChunk variable "lux compilation" (_.code code) loader)
- output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (:coerce java/lang/Object lua_function) (array.new 0)
+ output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (:as java/lang/Object lua_function) (array.new 0)
executor)]
(case (array.read 0 output)
#.None
@@ -570,7 +570,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.assume (:coerce _.Statement)))
+ (|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
(def: (re_learn context content)
(run! content))
@@ -607,7 +607,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.assume (:coerce _.Statement)))
+ (|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
(def: (re_learn context content)
(run! content))
@@ -626,13 +626,13 @@
(def: to_host
(-> Any java/lang/Object)
- (|>> (:coerce (Array java/lang/Object)) ..lux_structure (:coerce java/lang/Object)))
+ (|>> (:as (Array java/lang/Object)) ..lux_structure (:as java/lang/Object)))
(def: (return ec value)
(-> net/sandius/rembulan/runtime/ExecutionContext Any Any)
(|> ec
net/sandius/rembulan/runtime/ExecutionContext::getReturnBuffer
- (net/sandius/rembulan/runtime/ReturnBuffer::setTo (:coerce java/lang/Object value))))
+ (net/sandius/rembulan/runtime/ReturnBuffer::setTo (:as java/lang/Object value))))
(def: (host_phase partial_application phase)
(All [s i o]
@@ -659,7 +659,7 @@
[input/0 (..read input/0)]
(case partial_application
(^ (list partial/0 partial/1))
- (wrap (..to_host ((:coerce (-> Any Any Any Any) phase)
+ (wrap (..to_host ((:as (-> Any Any Any Any) phase)
partial/0
partial/1
input/0)))
@@ -686,7 +686,7 @@
input/1 (..read input/1)]
(case partial_application
(^ (list partial/0))
- (wrap (..to_host ((:coerce (-> Any Any Any Any) phase)
+ (wrap (..to_host ((:as (-> Any Any Any Any) phase)
partial/0
input/0
input/1)))
@@ -712,7 +712,7 @@
input/2 (..read input/2)]
(case partial_application
(^ (list))
- (wrap (..to_host ((:coerce (-> Any Any Any Any) phase)
+ (wrap (..to_host ((:as (-> Any Any Any Any) phase)
input/0
input/1
input/2)))
@@ -723,24 +723,24 @@
(def: (extender [state_context executor] phase_wrapper)
(-> Baggage (-> platform.Phase_Wrapper Extender))
## TODO: Stop relying on coercions ASAP.
- (<| (:coerce Extender)
+ (<| (:as Extender)
(function (@self handler))
- (:coerce Handler)
+ (:as Handler)
(function (@self name phase))
- (:coerce Phase)
+ (:as Phase)
(function (@self archive parameters))
- (:coerce Operation)
+ (:as Operation)
(function (@self state))
- (:coerce Try)
+ (:as Try)
try.assume
- (:coerce Try)
+ (:as Try)
(do try.monad
[handler (try.from_maybe (..ensure_function handler))
output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context
- (:coerce java/lang/Object handler)
+ (:as java/lang/Object handler)
(|> (array.new 5)
(array.write! 0 name)
- (array.write! 1 (:coerce java/lang/Object (phase_wrapper phase)))
+ (array.write! 1 (:as java/lang/Object (phase_wrapper phase)))
(array.write! 2 (..to_host archive))
(array.write! 3 (..to_host parameters))
(array.write! 4 (..to_host state)))
@@ -748,7 +748,7 @@
(|> output
(array.read 0)
maybe.assume
- (:coerce java/lang/Object)
+ (:as java/lang/Object)
..read)))))
@.lua
@@ -760,9 +760,9 @@
(-> Archive (runtime.Operation platform.Phase_Wrapper))
(do phase.monad
[]
- (wrap (:coerce platform.Phase_Wrapper
- (for {@.old (..host_phase (list))
- @.lua (|>>)})))))
+ (wrap (:as platform.Phase_Wrapper
+ (for {@.old (..host_phase (list))
+ @.lua (|>>)})))))
(for {@.old (def: platform
(IO [Baggage (Platform [Register _.Label] _.Expression _.Statement)])