From cd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 Sep 2021 01:21:23 -0400 Subject: Migrated variants to the new syntax. --- lux-ruby/source/program.lux | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'lux-ruby') diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 25e3cc2ab..37713dfdb 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -242,14 +242,14 @@ #.None (recur (++ idx) output) - (#.Some value) + {#.Some value} (case (read value) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success lux_value) + {#try.Success lux_value} (recur (++ idx) (array.write! idx lux_value output)))) - (#try.Success output))))) + {#try.Success output})))) (exception: (unknown_kind_of_object [object java/lang/Object]) (exception.report @@ -261,18 +261,18 @@ (case [(org/jruby/RubyHash::get (:as java/lang/String runtime.variant_tag_field) host_object) (org/jruby/RubyHash::get (:as java/lang/String runtime.variant_flag_field) host_object) (org/jruby/RubyHash::get (:as java/lang/String runtime.variant_value_field) host_object)] - (^multi [(#.Some tag) ?flag (#.Some value)] + (^multi [{#.Some tag} ?flag {#.Some value}] [(read value) - (#try.Success value)]) - (#try.Success [(:as Any (java/lang/Long::intValue (:as java/lang/Long tag))) + {#try.Success value}]) + {#try.Success [(:as Any (java/lang/Long::intValue (:as java/lang/Long tag))) (:as Any (case ?flag - (#.Some _) + {#.Some _} "" #.None (ffi.null))) - (:as Any value)]) + (:as Any value)]} _ (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) @@ -285,7 +285,7 @@ (exception.except ..nil_has_no_lux_representation [])) (~~ (template [ ] [(case (ffi.check host_object) - (#.Some typed_object) + {#.Some typed_object} (`` (|> typed_object (~~ (template.spliced )))) _)] @@ -316,27 +316,27 @@ (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (-> java/lang/Object org/jruby/runtime/builtin/IRubyObject)) (<| (case (ffi.check [java/lang/Object] value) - (#.Some value) + {#.Some value} (|> value (:as (Array java/lang/Object)) lux_structure) #.None) (case (ffi.check java/lang/Boolean value) - (#.Some value) + {#.Some value} (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime value) #.None) (case (ffi.check java/lang/Long value) - (#.Some value) + {#.Some value} (org/jruby/RubyFixnum::new ..initial_ruby_runtime value) #.None) (case (ffi.check java/lang/Double value) - (#.Some value) + {#.Some value} (org/jruby/RubyFloat::new ..initial_ruby_runtime value) #.None) (case (ffi.check java/lang/String value) - (#.Some value) + {#.Some value} (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime value) #.None) @@ -378,9 +378,9 @@ org/jruby/runtime/builtin/IRubyObject (let [member (ffi.read! 0 args)] (<| (case (ffi.check org/jruby/RubyFixnum member) - (#.Some member) + {#.Some member} (case (array.read! (org/jruby/RubyFixnum::getLongValue member) value) - (#.Some value) + {#.Some value} (wrapped_lux_value lux_structure value) #.None @@ -388,7 +388,7 @@ #.None) (case (ffi.check org/jruby/RubyString member) - (#.Some member) + {#.Some member} (case (:as Text (org/jruby/RubyString::asJavaString member)) (^ (static runtime.variant_tag_field)) (|> value @@ -403,12 +403,12 @@ #.None ..ruby_nil - (#.Some flag) + {#.Some flag} ..lux_unit) (^ (static runtime.variant_value_field)) (case (array.read! 2 value) - (#.Some value) + {#.Some value} (wrapped_lux_value lux_structure value) #.None @@ -419,10 +419,10 @@ #.None) (case (ffi.check org/jruby/RubyRange member) - (#.Some member) + {#.Some member} (case [(|> member (org/jruby/RubyRange::first thread_context) (ffi.check org/jruby/RubyFixnum)) (|> member (org/jruby/RubyRange::size thread_context) (ffi.check org/jruby/RubyFixnum))] - [(#.Some first) (#.Some size)] + [{#.Some first} {#.Some size}] (let [first (org/jruby/RubyFixnum::getLongValue first) size (org/jruby/RubyFixnum::getLongValue size)] (lux_structure (java/util/Arrays::copyOfRange value first (i.+ first size)))) @@ -448,10 +448,10 @@ org/jruby/runtime/builtin/IRubyObject (let [reference (ffi.read! 0 args)] (case (..read (:as java/lang/Object reference)) - (#try.Success reference) + {#try.Success reference} (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime (same? (: Any reference) (: Any value))) - (#try.Failure error) + {#try.Failure error} (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime false)))))) (def: (lux_wrapper_length value) @@ -508,7 +508,7 @@ (case (|> args (ffi.read! 0) (ffi.check org/jruby/RubySymbol)) - (#.Some method) + {#.Some method} (|> (case (|> method org/jruby/RubySymbol::asJavaString (:as Text)) @@ -585,16 +585,16 @@ (def: (expander macro inputs lux) Expander (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (case (call_macro inputs lux macro) - (#try.Success output) + {#try.Success output} (|> output (:as java/lang/Object) ..read (:as (Try (Try [Lux (List Code)])))) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))) @@ -692,7 +692,7 @@ (let [inputs (array.list #.None inputs)]) (case inputs (^ (list)) - (#try.Success (host_phase partial_application phase)) + {#try.Success (host_phase partial_application phase)} (^ (list input/0)) (do try.monad -- cgit v1.2.3