aboutsummaryrefslogtreecommitdiff
path: root/lux-scheme
diff options
context:
space:
mode:
Diffstat (limited to 'lux-scheme')
-rw-r--r--lux-scheme/source/program.lux88
1 files changed, 46 insertions, 42 deletions
diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux
index 1eac52eeb..3bbac2cf6 100644
--- a/lux-scheme/source/program.lux
+++ b/lux-scheme/source/program.lux
@@ -134,23 +134,23 @@
(def: (variant? value)
(-> Any Bit)
(case (ffi.check [java/lang/Object] (:as java/lang/Object value))
- {#.Some array}
+ {.#Some array}
... TODO: Get rid of this coercion ASAP.
(let [array (:as (Array java/lang/Object) array)]
(and (n.= 3 (array.size array))
(case (array.read! 0 array)
- {#.Some tag}
+ {.#Some tag}
(case (ffi.check java/lang/Integer tag)
- {#.Some _}
+ {.#Some _}
true
- #.None
+ {.#None}
false)
- #.None
+ {.#None}
false)))
- #.None
+ {.#None}
false))
(template [<name>]
@@ -177,10 +177,10 @@
[] (getCar self []) java/lang/Object
(if cdr?
(case (array.read! 1 value)
- {#.Some flag_is_set}
+ {.#Some flag_is_set}
true
- #.None
+ {.#None}
false)
(|> value
(array.read! 0)
@@ -243,12 +243,13 @@
(def: (lux_value value)
(-> java/lang/Object java/lang/Object)
(<| (case (ffi.check [java/lang/Object] value)
- {#.Some value}
+ {.#Some value}
... TODO: Get rid of the coercions below.
(if (variant? value)
(variant_value lux_value false (:as (Array java/lang/Object) value))
(tuple_value lux_value (:as (Array java/lang/Object) value)))
- #.None)
+
+ {.#None})
value))
(type: (Reader a)
@@ -269,10 +270,10 @@
[tag (read (gnu/lists/Pair::getCar host_object))
#let [host_object (:as gnu/lists/Pair (gnu/lists/Pair::getCdr host_object))
flag (case (ffi.check java/lang/Boolean (gnu/lists/Pair::getCar host_object))
- {#.Some flag}
+ {.#Some flag}
(:as Bit flag)
- #.None
+ {.#None}
(undefined))]
value (read (gnu/lists/Pair::getCdr host_object))]
(wrap (..variant (:as Nat tag) flag value))))
@@ -285,29 +286,31 @@
(array.new size))]
(if (n.< size idx)
(case (read (gnu/lists/FVector::getRaw (.int idx) host_object))
- {#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 (: Any lux_value) output)))
- {#try.Success output}))))
+ {try.#Success output}))))
(def: (read host_object)
(Reader java/lang/Object)
(`` (<| (~~ (template [<class>]
[(case (ffi.check <class> host_object)
- {#.Some host_object}
- {#try.Success host_object}
- #.None)]
+ {.#Some host_object}
+ {try.#Success host_object}
+
+ {.#None})]
[java/lang/Boolean] [java/lang/Long] [java/lang/Double] [java/lang/String]
[gnu/mapping/Procedure] [gnu/lists/U8Vector]
))
(~~ (template [<class> <processing>]
[(case (ffi.check <class> host_object)
- {#.Some host_object}
- {#try.Success (<| <processing> host_object)}
- #.None)]
+ {.#Some host_object}
+ {try.#Success (<| <processing> host_object)}
+
+ {.#None})]
[java/lang/Integer java/lang/Integer::longValue]
@@ -321,13 +324,15 @@
[program/TupleValue program/TupleValue::getValue]
))
(case (ffi.check gnu/lists/Pair host_object)
- {#.Some host_object}
+ {.#Some host_object}
(read_variant read host_object)
- #.None)
+
+ {.#None})
(case (ffi.check gnu/lists/FVector host_object)
- {#.Some host_object}
+ {.#Some host_object}
(read_tuple read (:as (gnu/lists/FVector java/lang/Object) host_object))
- #.None)
+
+ {.#None})
... else
(exception.throw ..unknown_kind_of_host_object host_object))))
@@ -338,21 +343,20 @@
(def: (expander macro inputs lux)
Expander
(case (..ensure_macro macro)
- {#.Some macro}
+ {.#Some macro}
(case (gnu/mapping/Procedure::apply2 (lux_value (:as java/lang/Object inputs))
(lux_value (:as java/lang/Object lux))
macro)
- {#try.Success output}
+ {try.#Success output}
(|> output
..read
(:as (Try (Try [Lux (List Code)]))))
- {#try.Failure error}
- {#try.Failure error})
+ {try.#Failure error}
+ {try.#Failure error})
- #.None
- (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro)))
- )
+ {.#None}
+ (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro))))
(def: host
(IO (Host _.Expression _.Expression))
@@ -395,11 +399,11 @@
(IO (Platform _.Var _.Expression _.Expression))
(do io.monad
[host ..host]
- (wrap [#platform.&file_system (file.async file.default)
- #platform.host host
- #platform.phase scheme.generate
- #platform.runtime runtime.generate
- #platform.write (|>> _.code (\ encoding.utf8 encoded))])))
+ (wrap [platform.#&file_system (file.async file.default)
+ platform.#host host
+ platform.#phase scheme.generate
+ platform.#runtime runtime.generate
+ platform.#write (|>> _.code (\ encoding.utf8 encoded))])))
(def: (program context program)
(Program _.Expression _.Expression)
@@ -450,10 +454,10 @@
[platform ..platform
now instant.now]
(exec (do promise.monad
- [_ (/.compiler [#/static.host @.scheme
- #/static.host_module_extension extension
- #/static.target (/cli.target service)
- #/static.artifact_extension extension]
+ [_ (/.compiler [/static.#host @.scheme
+ /static.#host_module_extension extension
+ /static.#target (/cli.target service)
+ /static.#artifact_extension extension]
..expander
analysis.bundle
(io.io platform)