aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/ffi.old.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/ffi.old.lux')
-rw-r--r--stdlib/source/library/lux/ffi.old.lux440
1 files changed, 233 insertions, 207 deletions
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 9ec503f1b..496b4475c 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -70,161 +70,187 @@
(def: member_separator "::")
... Types
-(type: JVM_Code Text)
+(type: JVM_Code
+ Text)
(type: BoundKind
- #UpperBound
- #LowerBound)
+ (Variant
+ #UpperBound
+ #LowerBound))
(type: #rec GenericType
- (#GenericTypeVar Text)
- (#GenericClass [Text (List GenericType)])
- (#GenericArray GenericType)
- (#GenericWildcard (Maybe [BoundKind GenericType])))
+ (Variant
+ (#GenericTypeVar Text)
+ (#GenericClass [Text (List GenericType)])
+ (#GenericArray GenericType)
+ (#GenericWildcard (Maybe [BoundKind GenericType]))))
(type: Type_Parameter
[Text (List GenericType)])
(type: Primitive_Mode
- #ManualPrM
- #AutoPrM)
+ (Variant
+ #ManualPrM
+ #AutoPrM))
(type: .public Privacy
- #PublicP
- #PrivateP
- #ProtectedP
- #DefaultP)
+ (Variant
+ #PublicP
+ #PrivateP
+ #ProtectedP
+ #DefaultP))
(type: .public State
- #VolatileS
- #FinalS
- #DefaultS)
+ (Variant
+ #VolatileS
+ #FinalS
+ #DefaultS))
(type: .public Inheritance
- #FinalI
- #AbstractI
- #DefaultI)
+ (Variant
+ #FinalI
+ #AbstractI
+ #DefaultI))
(type: Class_Kind
- #Class
- #Interface)
+ (Variant
+ #Class
+ #Interface))
(type: Class_Declaration
- {#class_name Text
- #class_params (List Type_Parameter)})
+ (Record
+ {#class_name Text
+ #class_params (List Type_Parameter)}))
-(type: StackFrame (primitive "java/lang/StackTraceElement"))
-(type: StackTrace (Array StackFrame))
+(type: StackFrame
+ (primitive "java/lang/StackTraceElement"))
+
+(type: StackTrace
+ (Array StackFrame))
(type: Super_Class_Decl
- {#super_class_name Text
- #super_class_params (List GenericType)})
+ (Record
+ {#super_class_name Text
+ #super_class_params (List GenericType)}))
(type: AnnotationParam
[Text Code])
(type: Annotation
- {#ann_name Text
- #ann_params (List AnnotationParam)})
+ (Record
+ {#ann_name Text
+ #ann_params (List AnnotationParam)}))
(type: Member_Declaration
- {#member_name Text
- #member_privacy Privacy
- #member_anns (List Annotation)})
+ (Record
+ {#member_name Text
+ #member_privacy Privacy
+ #member_anns (List Annotation)}))
(type: FieldDecl
- (#ConstantField GenericType Code)
- (#VariableField State GenericType))
+ (Variant
+ (#ConstantField GenericType Code)
+ (#VariableField State GenericType)))
(type: MethodDecl
- {#method_tvars (List Type_Parameter)
- #method_inputs (List GenericType)
- #method_output GenericType
- #method_exs (List GenericType)})
+ (Record
+ {#method_tvars (List Type_Parameter)
+ #method_inputs (List GenericType)
+ #method_output GenericType
+ #method_exs (List GenericType)}))
(type: ArgDecl
- {#arg_name Text
- #arg_type GenericType})
+ (Record
+ {#arg_name Text
+ #arg_type GenericType}))
(type: ConstructorArg
[GenericType Code])
(type: Method_Definition
- (#ConstructorMethod [Bit
- (List Type_Parameter)
- (List ArgDecl)
- (List ConstructorArg)
- Code
- (List GenericType)])
- (#VirtualMethod [Bit
- Bit
+ (Variant
+ (#ConstructorMethod [Bit
+ (List Type_Parameter)
+ (List ArgDecl)
+ (List ConstructorArg)
+ Code
+ (List GenericType)])
+ (#VirtualMethod [Bit
+ Bit
+ (List Type_Parameter)
+ Text
+ (List ArgDecl)
+ GenericType
+ Code
+ (List GenericType)])
+ (#OverridenMethod [Bit
+ Class_Declaration
+ (List Type_Parameter)
+ Text
+ (List ArgDecl)
+ GenericType
+ Code
+ (List GenericType)])
+ (#StaticMethod [Bit
(List Type_Parameter)
- Text
(List ArgDecl)
GenericType
Code
(List GenericType)])
- (#OverridenMethod [Bit
- Class_Declaration
- (List Type_Parameter)
- Text
+ (#AbstractMethod [(List Type_Parameter)
(List ArgDecl)
GenericType
- Code
(List GenericType)])
- (#StaticMethod [Bit
- (List Type_Parameter)
- (List ArgDecl)
- GenericType
- Code
- (List GenericType)])
- (#AbstractMethod [(List Type_Parameter)
- (List ArgDecl)
- GenericType
- (List GenericType)])
- (#NativeMethod [(List Type_Parameter)
- (List ArgDecl)
- GenericType
- (List GenericType)]))
+ (#NativeMethod [(List Type_Parameter)
+ (List ArgDecl)
+ GenericType
+ (List GenericType)])))
(type: Partial_Call
- {#pc_method Name
- #pc_args (List Code)})
+ (Record
+ {#pc_method Name
+ #pc_args (List Code)}))
(type: ImportMethodKind
- #StaticIMK
- #VirtualIMK)
+ (Variant
+ #StaticIMK
+ #VirtualIMK))
(type: ImportMethodCommons
- {#import_member_mode Primitive_Mode
- #import_member_alias Text
- #import_member_kind ImportMethodKind
- #import_member_tvars (List Type_Parameter)
- #import_member_args (List [Bit GenericType])
- #import_member_maybe? Bit
- #import_member_try? Bit
- #import_member_io? Bit})
+ (Record
+ {#import_member_mode Primitive_Mode
+ #import_member_alias Text
+ #import_member_kind ImportMethodKind
+ #import_member_tvars (List Type_Parameter)
+ #import_member_args (List [Bit GenericType])
+ #import_member_maybe? Bit
+ #import_member_try? Bit
+ #import_member_io? Bit}))
(type: ImportConstructorDecl
- {})
+ (Record
+ {}))
(type: ImportMethodDecl
- {#import_method_name Text
- #import_method_return GenericType})
+ (Record
+ {#import_method_name Text
+ #import_method_return GenericType}))
(type: ImportFieldDecl
- {#import_field_mode Primitive_Mode
- #import_field_name Text
- #import_field_static? Bit
- #import_field_maybe? Bit
- #import_field_setter? Bit
- #import_field_type GenericType})
+ (Record
+ {#import_field_mode Primitive_Mode
+ #import_field_name Text
+ #import_field_static? Bit
+ #import_field_maybe? Bit
+ #import_field_setter? Bit
+ #import_field_type GenericType}))
(type: Import_Member_Declaration
- (#EnumDecl (List Text))
- (#ConstructorDecl [ImportMethodCommons ImportConstructorDecl])
- (#MethodDecl [ImportMethodCommons ImportMethodDecl])
- (#FieldAccessDecl ImportFieldDecl))
+ (Variant
+ (#EnumDecl (List Text))
+ (#ConstructorDecl [ImportMethodCommons ImportConstructorDecl])
+ (#MethodDecl [ImportMethodCommons ImportMethodDecl])
+ (#FieldAccessDecl ImportFieldDecl)))
... Utils
(def: (manual_primitive_type class)
@@ -284,7 +310,7 @@
[[name params] _ _]
(let [name (safe name)
- =params (list\map (class_type' mode type_params in_array?) params)]
+ =params (list\each (class_type' mode type_params in_array?) params)]
(` (primitive (~ (code.text name)) [(~+ =params)])))))
(def: (class_type' mode type_params in_array? class)
@@ -326,15 +352,15 @@
(def: (class_decl_type$ (^slots [#class_name #class_params]))
(-> Class_Declaration Code)
- (let [=params (list\map (: (-> Type_Parameter Code)
- (function (_ [pname pbounds])
- (case pbounds
- #.End
- (code.identifier ["" pname])
-
- (#.Item bound1 _)
- (class_type #ManualPrM class_params bound1))))
- class_params)]
+ (let [=params (list\each (: (-> Type_Parameter Code)
+ (function (_ [pname pbounds])
+ (case pbounds
+ #.End
+ (code.identifier ["" pname])
+
+ (#.Item bound1 _)
+ (class_type #ManualPrM class_params bound1))))
+ class_params)]
(` (primitive (~ (code.text (safe class_name)))
[(~+ =params)]))))
@@ -411,15 +437,15 @@
(case (f input)
(^template [<tag>]
[[meta (<tag> parts)]
- [meta (<tag> (list\map (pre_walk_replace f) parts))]])
+ [meta (<tag> (list\each (pre_walk_replace f) parts))]])
([#.Form]
[#.Tuple])
[meta (#.Record pairs)]
- [meta (#.Record (list\map (: (-> [Code Code] [Code Code])
- (function (_ [key val])
- [(pre_walk_replace f key) (pre_walk_replace f val)]))
- pairs))]
+ [meta (#.Record (list\each (: (-> [Code Code] [Code Code])
+ (function (_ [key val])
+ [(pre_walk_replace f key) (pre_walk_replace f val)]))
+ pairs))]
ast'
ast'))
@@ -450,7 +476,7 @@
[args (: (Parser (List Code))
(<code>.form (<>.after (<code>.this! (' ::new!))
(<code>.tuple (<>.exactly (list.size arg_decls) <code>.any)))))
- .let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ params)) arg_decls))]]
+ .let [arg_decls' (: (List Text) (list\each (|>> product.right (simple_class$ params)) arg_decls))]]
(in (` ((~ (code.text (format "jvm new" ":" class_name ":" (text.interposed "," arg_decls'))))
(~+ args))))))
@@ -461,7 +487,7 @@
args (: (Parser (List Code))
(<code>.form (<>.after (<code>.this! (code.identifier ["" dotted_name]))
(<code>.tuple (<>.exactly (list.size arg_decls) <code>.any)))))
- .let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ params)) arg_decls))]]
+ .let [arg_decls' (: (List Text) (list\each (|>> product.right (simple_class$ params)) arg_decls))]]
(in (`' ((~ (code.text (format "jvm invokestatic" ":" class_name ":" method_name ":" (text.interposed "," arg_decls'))))
(~+ args))))))
@@ -473,7 +499,7 @@
args (: (Parser (List Code))
(<code>.form (<>.after (<code>.this! (code.identifier ["" dotted_name]))
(<code>.tuple (<>.exactly (list.size arg_decls) <code>.any)))))
- .let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ params)) arg_decls))]]
+ .let [arg_decls' (: (List Text) (list\each (|>> product.right (simple_class$ params)) arg_decls))]]
(in (`' ((~ (code.text (format <jvm_op> ":" class_name ":" method_name ":" (text.interposed "," arg_decls'))))
(~' _jvm_this) (~+ args))))))]
@@ -544,7 +570,7 @@
(do <>.monad
[name <code>.local_identifier
_ (no_periods_assertion name)]
- (if (list.member? text.equivalence (list\map product.left type_vars) name)
+ (if (list.member? text.equivalence (list\each product.left type_vars) name)
(in (#GenericTypeVar name))
(in (#GenericClass name (list)))))
(<code>.tuple (do <>.monad
@@ -569,7 +595,7 @@
_ (no_periods_assertion name)
params (<>.some recur^)
_ (<>.assertion (format name " cannot be a type-parameter!")
- (not (list.member? text.equivalence (list\map product.left type_vars) name)))]
+ (not (list.member? text.equivalence (list\each product.left type_vars) name)))]
(in (#GenericClass name params))))
))))
@@ -713,7 +739,7 @@
[pm privacy_modifier^
strict_fp? (<>.parses? (<code>.this! (' #strict)))
method_vars ..type_params^
- .let [total_vars (list\compose class_vars method_vars)]
+ .let [total_vars (list\composite class_vars method_vars)]
[_ arg_decls] (<code>.form (<>.and (<code>.this! (' new))
(..arg_decls^ total_vars)))
constructor_args (..constructor_args^ total_vars)
@@ -732,7 +758,7 @@
strict_fp? (<>.parses? (<code>.this! (' #strict)))
final? (<>.parses? (<code>.this! (' #final)))
method_vars ..type_params^
- .let [total_vars (list\compose class_vars method_vars)]
+ .let [total_vars (list\composite class_vars method_vars)]
[name this_name arg_decls] (<code>.form ($_ <>.and
<code>.local_identifier
<code>.local_identifier
@@ -755,7 +781,7 @@
[strict_fp? (<>.parses? (<code>.this! (' #strict)))
owner_class ..class_decl^
method_vars ..type_params^
- .let [total_vars (list\compose (product.right owner_class) method_vars)]
+ .let [total_vars (list\composite (product.right owner_class) method_vars)]
[name this_name arg_decls] (<code>.form ($_ <>.and
<code>.local_identifier
<code>.local_identifier
@@ -879,7 +905,7 @@
[tvars ..type_params^
_ (<code>.this! (' new))
?alias import_member_alias^
- .let [total_vars (list\compose owner_vars tvars)]
+ .let [total_vars (list\composite owner_vars tvars)]
?prim_mode (<>.maybe primitive_mode^)
args (..import_member_args^ total_vars)
[io? try? maybe?] import_member_return_flags^]
@@ -900,7 +926,7 @@
tvars ..type_params^
name <code>.local_identifier
?alias import_member_alias^
- .let [total_vars (list\compose owner_vars tvars)]
+ .let [total_vars (list\composite owner_vars tvars)]
?prim_mode (<>.maybe primitive_mode^)
args (..import_member_args^ total_vars)
[io? try? maybe?] import_member_return_flags^
@@ -972,7 +998,7 @@
(def: (annotation$ [name params])
(-> Annotation JVM_Code)
- (format "(" name " " "{" (text.interposed text.tab (list\map annotation_param$ params)) "}" ")"))
+ (format "(" name " " "{" (text.interposed text.tab (list\each annotation_param$ params)) "}" ")"))
(def: (bound_kind$ kind)
(-> BoundKind JVM_Code)
@@ -987,7 +1013,7 @@
name
(#GenericClass name params)
- (format "(" (safe name) " " (spaced (list\map generic_type$ params)) ")")
+ (format "(" (safe name) " " (spaced (list\each generic_type$ params)) ")")
(#GenericArray param)
(format "(" array.type_name " " (generic_type$ param) ")")
@@ -1000,25 +1026,25 @@
(def: (type_param$ [name bounds])
(-> Type_Parameter JVM_Code)
- (format "(" name " " (spaced (list\map generic_type$ bounds)) ")"))
+ (format "(" name " " (spaced (list\each generic_type$ bounds)) ")"))
(def: (class_decl$ (^open "."))
(-> Class_Declaration JVM_Code)
- (format "(" (safe class_name) " " (spaced (list\map type_param$ class_params)) ")"))
+ (format "(" (safe class_name) " " (spaced (list\each type_param$ class_params)) ")"))
(def: (super_class_decl$ (^slots [#super_class_name #super_class_params]))
(-> Super_Class_Decl JVM_Code)
- (format "(" (safe super_class_name) " " (spaced (list\map generic_type$ super_class_params)) ")"))
+ (format "(" (safe super_class_name) " " (spaced (list\each generic_type$ super_class_params)) ")"))
(def: (method_decl$ [[name pm anns] method_decl])
(-> [Member_Declaration MethodDecl] JVM_Code)
(let [(^slots [#method_tvars #method_inputs #method_output #method_exs]) method_decl]
(with_parens
(spaced (list name
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ method_tvars)))
- (with_brackets (spaced (list\map generic_type$ method_exs)))
- (with_brackets (spaced (list\map generic_type$ method_inputs)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ method_tvars)))
+ (with_brackets (spaced (list\each generic_type$ method_exs)))
+ (with_brackets (spaced (list\each generic_type$ method_inputs)))
(generic_type$ method_output))
))))
@@ -1035,7 +1061,7 @@
(#ConstantField class value)
(with_parens
(spaced (list "constant" name
- (with_brackets (spaced (list\map annotation$ anns)))
+ (with_brackets (spaced (list\each annotation$ anns)))
(generic_type$ class)
(code.format value))
))
@@ -1045,7 +1071,7 @@
(spaced (list "variable" name
(privacy_modifier$ pm)
(state_modifier$ sm)
- (with_brackets (spaced (list\map annotation$ anns)))
+ (with_brackets (spaced (list\each annotation$ anns)))
(generic_type$ class))
))
))
@@ -1068,11 +1094,11 @@
(spaced (list "init"
(privacy_modifier$ pm)
(bit\encoded strict_fp?)
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ type_vars)))
- (with_brackets (spaced (list\map generic_type$ exs)))
- (with_brackets (spaced (list\map arg_decl$ arg_decls)))
- (with_brackets (spaced (list\map constructor_arg$ constructor_args)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ type_vars)))
+ (with_brackets (spaced (list\each generic_type$ exs)))
+ (with_brackets (spaced (list\each arg_decl$ arg_decls)))
+ (with_brackets (spaced (list\each constructor_arg$ constructor_args)))
(code.format (pre_walk_replace replacer body))
)))
@@ -1083,10 +1109,10 @@
(privacy_modifier$ pm)
(bit\encoded final?)
(bit\encoded strict_fp?)
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ type_vars)))
- (with_brackets (spaced (list\map generic_type$ exs)))
- (with_brackets (spaced (list\map arg_decl$ arg_decls)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ type_vars)))
+ (with_brackets (spaced (list\each generic_type$ exs)))
+ (with_brackets (spaced (list\each arg_decl$ arg_decls)))
(generic_type$ return_type)
(code.format (pre_walk_replace replacer (` (let [(~ (code.local_identifier this_name)) (~' _jvm_this)]
(~ body))))))))
@@ -1095,8 +1121,8 @@
(let [super_replacer (parser_replacer (<code>.form (do <>.monad
[_ (<code>.this! (' ::super!))
args (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))
- .let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ (list)))
- arg_decls))]]
+ .let [arg_decls' (: (List Text) (list\each (|>> product.right (simple_class$ (list)))
+ arg_decls))]]
(in (`' ((~ (code.text (format "jvm invokespecial"
":" (value@ #super_class_name super_class)
":" name
@@ -1107,10 +1133,10 @@
(class_decl$ class_decl)
name
(bit\encoded strict_fp?)
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ type_vars)))
- (with_brackets (spaced (list\map generic_type$ exs)))
- (with_brackets (spaced (list\map arg_decl$ arg_decls)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ type_vars)))
+ (with_brackets (spaced (list\each generic_type$ exs)))
+ (with_brackets (spaced (list\each arg_decl$ arg_decls)))
(generic_type$ return_type)
(|> (` (let [(~ (code.local_identifier this_name)) (~' _jvm_this)]
(~ body)))
@@ -1125,10 +1151,10 @@
name
(privacy_modifier$ pm)
(bit\encoded strict_fp?)
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ type_vars)))
- (with_brackets (spaced (list\map generic_type$ exs)))
- (with_brackets (spaced (list\map arg_decl$ arg_decls)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ type_vars)))
+ (with_brackets (spaced (list\each generic_type$ exs)))
+ (with_brackets (spaced (list\each arg_decl$ arg_decls)))
(generic_type$ return_type)
(code.format (pre_walk_replace replacer body)))))
@@ -1137,10 +1163,10 @@
(spaced (list "abstract"
name
(privacy_modifier$ pm)
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ type_vars)))
- (with_brackets (spaced (list\map generic_type$ exs)))
- (with_brackets (spaced (list\map arg_decl$ arg_decls)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ type_vars)))
+ (with_brackets (spaced (list\each generic_type$ exs)))
+ (with_brackets (spaced (list\each arg_decl$ arg_decls)))
(generic_type$ return_type))))
(#NativeMethod type_vars arg_decls return_type exs)
@@ -1148,10 +1174,10 @@
(spaced (list "native"
name
(privacy_modifier$ pm)
- (with_brackets (spaced (list\map annotation$ anns)))
- (with_brackets (spaced (list\map type_param$ type_vars)))
- (with_brackets (spaced (list\map generic_type$ exs)))
- (with_brackets (spaced (list\map arg_decl$ arg_decls)))
+ (with_brackets (spaced (list\each annotation$ anns)))
+ (with_brackets (spaced (list\each type_param$ type_vars)))
+ (with_brackets (spaced (list\each generic_type$ exs)))
+ (with_brackets (spaced (list\each arg_decl$ arg_decls)))
(generic_type$ return_type))))
))
@@ -1209,19 +1235,19 @@
(do meta.monad
[current_module meta.current_module_name
.let [fully_qualified_class_name (format (safe current_module) "." full_class_name)
- field_parsers (list\map (field_parser fully_qualified_class_name) fields)
- method_parsers (list\map (method_parser (product.right class_decl) fully_qualified_class_name) methods)
+ field_parsers (list\each (field_parser fully_qualified_class_name) fields)
+ method_parsers (list\each (method_parser (product.right class_decl) fully_qualified_class_name) methods)
replacer (parser_replacer (list\mix <>.either
(<>.failure "")
- (list\compose field_parsers method_parsers)))
+ (list\composite field_parsers method_parsers)))
def_code (format "jvm class:"
(spaced (list (class_decl$ class_decl)
(super_class_decl$ super)
- (with_brackets (spaced (list\map super_class_decl$ interfaces)))
+ (with_brackets (spaced (list\each super_class_decl$ interfaces)))
(inheritance_modifier$ im)
- (with_brackets (spaced (list\map annotation$ annotations)))
- (with_brackets (spaced (list\map field_decl$ fields)))
- (with_brackets (spaced (list\map (method_def$ replacer super) methods))))))]]
+ (with_brackets (spaced (list\each annotation$ annotations)))
+ (with_brackets (spaced (list\each field_decl$ fields)))
+ (with_brackets (spaced (list\each (method_def$ replacer super) methods))))))]]
(in (list (` ((~ (code.text def_code))))))))
(syntax: .public (interface: [class_decl ..class_decl^
@@ -1235,9 +1261,9 @@
([] foo [boolean String] void #throws [Exception])))}
(let [def_code (format "jvm interface:"
(spaced (list (class_decl$ class_decl)
- (with_brackets (spaced (list\map super_class_decl$ supers)))
- (with_brackets (spaced (list\map annotation$ annotations)))
- (spaced (list\map method_decl$ members)))))]
+ (with_brackets (spaced (list\each super_class_decl$ supers)))
+ (with_brackets (spaced (list\each annotation$ annotations)))
+ (spaced (list\each method_decl$ members)))))]
(in (list (` ((~ (code.text def_code))))))
))
@@ -1261,9 +1287,9 @@
)}
(let [def_code (format "jvm anon-class:"
(spaced (list (super_class_decl$ super)
- (with_brackets (spaced (list\map super_class_decl$ interfaces)))
- (with_brackets (spaced (list\map constructor_arg$ constructor_args)))
- (with_brackets (spaced (list\map (method_def$ function.identity super) methods))))))]
+ (with_brackets (spaced (list\each super_class_decl$ interfaces)))
+ (with_brackets (spaced (list\each constructor_arg$ constructor_args)))
+ (with_brackets (spaced (list\each (method_def$ function.identity super) methods))))))]
(in (list (` ((~ (code.text def_code))))))))
(syntax: .public (null [])
@@ -1351,12 +1377,12 @@
(ClassName::method2 arg3 arg4 arg5)))}
(with_identifiers [g!obj]
(in (list (` (let [(~ g!obj) (~ obj)]
- (exec (~+ (list\map (complete_call$ g!obj) methods))
+ (exec (~+ (list\each (complete_call$ g!obj) methods))
(~ g!obj))))))))
(def: (class_import$ [full_name params])
(-> Class_Declaration Code)
- (let [params' (list\map (|>> product.left code.local_identifier) params)]
+ (let [params' (list\each (|>> product.left code.local_identifier) params)]
(` (def: (~ (code.identifier ["" full_name]))
{#..jvm_class (~ (code.text full_name))}
Type
@@ -1368,7 +1394,7 @@
(-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter))
(case member
(#ConstructorDecl [commons _])
- (list\compose class_tvars (value@ #import_member_tvars commons))
+ (list\composite class_tvars (value@ #import_member_tvars commons))
(#MethodDecl [commons _])
(case (value@ #import_member_kind commons)
@@ -1376,7 +1402,7 @@
(value@ #import_member_tvars commons)
_
- (list\compose class_tvars (value@ #import_member_tvars commons)))
+ (list\composite class_tvars (value@ #import_member_tvars commons)))
_
class_tvars))
@@ -1387,22 +1413,22 @@
(^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _]))
(let [(^slots [#import_member_tvars #import_member_args]) commons]
(do {! meta.monad}
- [arg_inputs (monad.map !
- (: (-> [Bit GenericType] (Meta [Bit Code]))
- (function (_ [maybe? _])
- (with_identifiers [arg_name]
- (in [maybe? arg_name]))))
- import_member_args)
+ [arg_inputs (monad.each !
+ (: (-> [Bit GenericType] (Meta [Bit Code]))
+ (function (_ [maybe? _])
+ (with_identifiers [arg_name]
+ (in [maybe? arg_name]))))
+ import_member_args)
.let [arg_classes (: (List Text)
- (list\map (|>> product.right (simple_class$ (list\compose type_params import_member_tvars)))
- import_member_args))
- arg_types (list\map (: (-> [Bit GenericType] Code)
- (function (_ [maybe? arg])
- (let [arg_type (class_type (value@ #import_member_mode commons) type_params arg)]
- (if maybe?
- (` (Maybe (~ arg_type)))
- arg_type))))
- import_member_args)]]
+ (list\each (|>> product.right (simple_class$ (list\composite type_params import_member_tvars)))
+ import_member_args))
+ arg_types (list\each (: (-> [Bit GenericType] Code)
+ (function (_ [maybe? arg])
+ (let [arg_type (class_type (value@ #import_member_mode commons) type_params arg)]
+ (if maybe?
+ (` (Maybe (~ arg_type)))
+ arg_type))))
+ import_member_args)]]
(in [arg_inputs arg_classes arg_types])))
_
@@ -1478,12 +1504,12 @@
(def: (jvm_extension_inputs mode classes inputs)
(-> Primitive_Mode (List Text) (List [Bit Code]) (List Code))
(|> inputs
- (list\map (function (_ [maybe? input])
- (if maybe?
- (` ((~! !!!) (~ (un_quote input))))
- (un_quote input))))
+ (list\each (function (_ [maybe? input])
+ (if maybe?
+ (` ((~! !!!) (~ (un_quote input))))
+ (un_quote input))))
(list.zipped/2 classes)
- (list\map (auto_convert_input mode))))
+ (list\each (auto_convert_input mode))))
(def: (import_name format class member)
(-> Text Text Text Text)
@@ -1493,9 +1519,9 @@
(def: syntax_inputs
(-> (List Code) (List Code))
- (|>> (list\map (function (_ name)
- (list name (` (~! <code>.any)))))
- list\join))
+ (|>> (list\each (function (_ name)
+ (list name (` (~! <code>.any)))))
+ list\conjoint))
(def: (member_def_interop type_params kind class [arg_function_inputs arg_classes arg_types] member method_prefix import_format)
(-> (List Type_Parameter) Class_Kind Class_Declaration [(List [Bit Code]) (List Text) (List Code)] Import_Member_Declaration Text Text (Meta (List Code)))
@@ -1503,7 +1529,7 @@
full_name (safe full_name)
all_params (|> (member_type_vars class_tvars member)
(list.only free_type_param?)
- (list\map lux_type_parameter))]
+ (list\each lux_type_parameter))]
(case member
(#EnumDecl enum_members)
(do {! meta.monad}
@@ -1515,7 +1541,7 @@
_
(let [=class_tvars (|> class_tvars
(list.only free_type_param?)
- (list\map lux_type_parameter))]
+ (list\each lux_type_parameter))]
(` (All [(~+ =class_tvars)] (primitive (~ (code.text full_name)) [(~+ =class_tvars)]))))))
getter_interop (: (-> Text Code)
(function (_ name)
@@ -1523,7 +1549,7 @@
(` (def: (~ getter_name)
(~ enum_type)
((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]]
- (in (list\map getter_interop enum_members)))
+ (in (list\each getter_interop enum_members)))
(#ConstructorDecl [commons _])
(do meta.monad
@@ -1534,7 +1560,7 @@
(decorate_return_maybe class member)
(decorate_return_try member)
(decorate_return_io member))]]
- (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list\map product.right arg_function_inputs)))])
+ (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list\each product.right arg_function_inputs)))])
((~' in) (.list (.` (~ jvm_interop)))))))))
(#MethodDecl [commons method])
@@ -1561,13 +1587,13 @@
)))
jvm_extension (code.text (format "jvm " jvm_op ":" full_name ":" import_method_name ":" (text.interposed "," arg_classes)))
jvm_interop (|> [(simple_class$ (list) (value@ #import_method_return method))
- (` ((~ jvm_extension) (~+ (list\map un_quote object_ast))
+ (` ((~ jvm_extension) (~+ (list\each un_quote object_ast))
(~+ (jvm_extension_inputs (value@ #import_member_mode commons) arg_classes arg_function_inputs))))]
(auto_convert_output (value@ #import_member_mode commons))
(decorate_return_maybe class member)
(decorate_return_try member)
(decorate_return_io member))]]
- (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list\map product.right arg_function_inputs)))
+ (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list\each product.right arg_function_inputs)))
(~+ (syntax_inputs object_ast))])
((~' in) (.list (.` (~ jvm_interop))))))))))
@@ -1582,7 +1608,7 @@
tvar_asts (: (List Code)
(|> class_tvars
(list.only free_type_param?)
- (list\map lux_type_parameter)))
+ (list\each lux_type_parameter)))
getter_name (code.identifier ["" (..import_name import_format method_prefix import_field_name)])
setter_name (code.identifier ["" (..import_name import_format method_prefix (format import_field_name "!"))])]
getter_interop (with_identifiers [g!obj]
@@ -1715,11 +1741,11 @@
(do {! meta.monad}
[kind (class_kind class_decl)
=members (|> bundles
- (list\map (function (_ [import_format members])
- (list\map (|>> [import_format]) members)))
+ (list\each (function (_ [import_format members])
+ (list\each (|>> [import_format]) members)))
list.together
- (monad.map ! (member_import$ (product.right class_decl) kind class_decl)))]
- (in (list& (class_import$ class_decl) (list\join =members)))))
+ (monad.each ! (member_import$ (product.right class_decl) kind class_decl)))]
+ (in (list& (class_import$ class_decl) (list\conjoint =members)))))
(syntax: .public (array [type (..generic_type^ (list))
size <code>.any])