diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/host.old.lux | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux index 0d95d6e9e..2fc846e18 100644 --- a/stdlib/source/lux/host.old.lux +++ b/stdlib/source/lux/host.old.lux @@ -1634,25 +1634,29 @@ [=args (member_def_arg_bindings type_params class member)] (member_def_interop type_params kind class =args member method_prefix import_format)))) -(def: (interface? class) - (All [a] (-> (primitive "java.lang.Class" [a]) Bit)) - ("jvm invokevirtual:java.lang.Class:isInterface:" class)) +(type: (java/lang/Class a) + (primitive "java.lang.Class" [a])) + +(def: interface? + (All [a] (-> (java/lang/Class a) Bit)) + (|>> "jvm invokevirtual:java.lang.Class:isInterface:")) (def: (load_class class_name) - (-> Text (Try (primitive "java.lang.Class" [Any]))) - (try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class_name))) + (-> Text (Try (java/lang/Class Any))) + (..try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class_name))) (def: (class_kind [class_name _]) (-> Class_Declaration (Meta Class_Kind)) - (let [class_name (sanitize class_name)] - (case (load_class class_name) - (#.Right class) + (let [class_name (..sanitize class_name)] + (case (..load_class class_name) + (#try.Success class) (\ meta.monad wrap (if (interface? class) #Interface #Class)) - (#.Left _) - (meta.fail (format "Unknown class: " class_name))))) + (#try.Failure error) + (meta.fail (format "Cannot load class: " class_name text.new_line + error))))) (syntax: #export (import: {class_decl ..class_decl^} |