Skip to content

Commit

Permalink
Better type coercions.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed May 14, 2024
1 parent d184a37 commit a296af3
Show file tree
Hide file tree
Showing 92 changed files with 1,879 additions and 1,656 deletions.
1 change: 1 addition & 0 deletions documentation/bookmark/tool/text_editor/structural.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Reference

0. [Pushing CSS :has() to its limits - hover-highlighted parentheses, variable bindings, and more](https://blog.mjgrzymek.com/blog/css-has)
0. [Tree-edit: Structural editing in Emacs for any™ language!](https://github.com/ethan-leba/tree-edit)
0. [Awesome Structure Editors](https://github.com/yairchu/awesome-structure-editors)
0. [Restructuring Structure Editing](https://tylr.fun/essay/)
Expand Down
40 changes: 18 additions & 22 deletions lux-jvm/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@
Expander
(do try.monad
[apply_method (|> macro
(as java/lang/Object)
(as (-> Macro java/lang/Object))
(java/lang/Object::getClass [])
(java/lang/Class::getMethod [(ffi.as_string "apply") _apply2_args]))]
(as (Try (Try [analysis.State (List @type.Code)]))
(as (-> (Try java/lang/Object) (Try (Try [analysis.State (List @type.Code)])))
(java/lang/reflect/Method::invoke
[(as java/lang/Object macro)
[(as (-> Macro java/lang/Object) macro)
(ffi.array java/lang/Object
[(as java/lang/Object inputs)
(as java/lang/Object lux)])]
[(as (-> (List Code) java/lang/Object) inputs)
(as (-> Lux java/lang/Object) lux)])]
apply_method))))

(the phase_wrapper
Expand All @@ -126,29 +126,25 @@
(the extender
extension.Extender
... TODO: Stop relying on coercions ASAP.
(<| (as extension.Extender)
(function (@self handler))
(as extension.Handler)
(function (@self phase))
(as phase.Phase)
(function (@self archive parameters))
(as phase.Operation)
(function (@self state))
(as Try)
(<| (function (@self handler
phase
archive parameters
state))
(as (-> Any Try))
try.trusted
(as Try)
(as (-> Any Try))
(do try.monad
[method (|> handler
(as java/lang/Object)
(as (-> Any java/lang/Object))
(java/lang/Object::getClass [])
(java/lang/Class::getMethod [(ffi.as_string "apply") _apply4_args]))]
(java/lang/reflect/Method::invoke
[(as java/lang/Object handler)
[(as (-> Any java/lang/Object) handler)
(ffi.array java/lang/Object
[(as java/lang/Object (phase_wrapper phase))
(as java/lang/Object archive)
(as java/lang/Object parameters)
(as java/lang/Object state)])]
[(as (-> Any java/lang/Object) (phase_wrapper phase))
(as (-> Any java/lang/Object) archive)
(as (-> Any java/lang/Object) parameters)
(as (-> Any java/lang/Object) state)])]
method))))

(the (declare_success! _)
Expand All @@ -161,7 +157,7 @@
(exec
(do future.monad
[[loader host platform] (future.soon ..platform)
_ (compositor.compiler (|>> (as platform.Custom))
_ (compositor.compiler (|>> (as (-> Any platform.Custom)))
context
..expander
(extension/analysis.bundle loader host)
Expand Down
Loading

0 comments on commit a296af3

Please sign in to comment.