diff options
Diffstat (limited to 'stdlib/source/library/lux/target/jvm')
37 files changed, 448 insertions, 416 deletions
diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 6d94c1b5b..0aa919723 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -25,12 +25,12 @@ ["#." constant (#+ Constant)] ["#." code]]) -(type: #export (Info about) +(type: .public (Info about) {#name (Index UTF8) #length U4 #info about}) -(def: #export (info_equivalence Equivalence<about>) +(def: .public (info_equivalence Equivalence<about>) (All [about] (-> (Equivalence about) (Equivalence (Info about)))) @@ -51,15 +51,15 @@ (|>> nameT lengthT infoT)]))) (with_expansions [<Code> (as_is (/code.Code Attribute))] - (type: #export #rec Attribute + (type: .public #rec Attribute (#Constant (Info (Constant Any))) (#Code (Info <Code>))) - (type: #export Code + (type: .public Code <Code>) ) -(def: #export equivalence +(def: .public equivalence (Equivalence Attribute) (equivalence.rec (function (_ equivalence) @@ -90,7 +90,7 @@ #length (|> /constant.length //unsigned.u4 try.assumed) #info index})) -(def: #export (constant index) +(def: .public (constant index) (-> (Constant Any) (Resource Attribute)) (do //constant/pool.monad [@name (//constant/pool.utf8 "ConstantValue")] @@ -107,13 +107,13 @@ try.assumed) #info specification})) -(def: #export (code specification) +(def: .public (code specification) (-> Code (Resource Attribute)) (do //constant/pool.monad [@name (//constant/pool.utf8 "Code")] (in (code' @name specification)))) -(def: #export (writer value) +(def: .public (writer value) (Writer Attribute) (case value (#Constant attribute) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index 2f80d96d2..733fd4d7c 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -22,13 +22,13 @@ ["." / #_ ["#." exception (#+ Exception)]]) -(type: #export (Code Attribute) +(type: .public (Code Attribute) {#limit Limit #code Binary #exception_table (Row Exception) #attributes (Row Attribute)}) -(def: #export (length length code) +(def: .public (length length code) (All [Attribute] (-> (-> Attribute Nat) (Code Attribute) Nat)) ($_ n.+ ## u2 max_stack; @@ -53,7 +53,7 @@ (row\map length) (row\fold n.+ 0)))) -(def: #export (equivalence attribute_equivalence) +(def: .public (equivalence attribute_equivalence) (All [attribute] (-> (Equivalence attribute) (Equivalence (Code attribute)))) ($_ product.equivalence @@ -64,7 +64,7 @@ )) ## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: #export (writer writer code) +(def: .public (writer writer code) (All [Attribute] (-> (Writer Attribute) (Writer (Code Attribute)))) ($_ binaryF\compose ## u2 max_stack; diff --git a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux index e2aa089b0..42bb8ebb9 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux @@ -19,13 +19,13 @@ [encoding ["#." unsigned (#+ U2)]]]]) -(type: #export Exception +(type: .public Exception {#start Address #end Address #handler Address #catch (Index Class)}) -(def: #export equivalence +(def: .public equivalence (Equivalence Exception) ($_ product.equivalence ////address.equivalence @@ -35,7 +35,7 @@ )) ## https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: #export length +(def: .public length Nat ($_ n.+ ## u2 start_pc; @@ -48,7 +48,7 @@ ////unsigned.bytes/2 )) -(def: #export writer +(def: .public writer (Writer Exception) ($_ format.and ////address.writer diff --git a/stdlib/source/library/lux/target/jvm/attribute/constant.lux b/stdlib/source/library/lux/target/jvm/attribute/constant.lux index d9f26d418..8d7a0a26a 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/constant.lux @@ -12,16 +12,16 @@ [encoding ["#." unsigned (#+ U2 U4)]]]) -(type: #export (Constant a) +(type: .public (Constant a) (Index (Value a))) -(def: #export equivalence +(def: .public equivalence (All [a] (Equivalence (Constant a))) ///index.equivalence) -(def: #export length +(def: .public length ///index.length) -(def: #export writer +(def: .public writer (All [a] (Writer (Constant a))) ///index.writer) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index a22ff102b..fa48223ae 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -51,11 +51,11 @@ ["." reflection] ["." parser]]]]) -(type: #export Label Nat) +(type: .public Label Nat) -(type: #export Resolver (Dictionary Label [Stack (Maybe Address)])) +(type: .public Resolver (Dictionary Label [Stack (Maybe Address)])) -(type: #export Tracker +(type: .public Tracker {#program_counter Address #next Label #known Resolver}) @@ -66,7 +66,7 @@ #next 0 #known (dictionary.empty n.hash)}) -(type: #export Relative +(type: .public Relative (-> Resolver (Try [(Row Exception) Instruction]))) (def: no_exceptions @@ -97,10 +97,10 @@ (in [(\ row.monoid compose left_exceptions right_exceptions) (_\compose left_instruction right_instruction)])))))) -(type: #export (Bytecode a) +(type: .public (Bytecode a) (+State Try [Pool Environment Tracker] (Writer Relative a))) -(def: #export new_label +(def: .public new_label (Bytecode Label) (function (_ [pool environment tracker]) (#try.Success [[pool @@ -109,11 +109,11 @@ [..relative_identity (get@ #next tracker)]]))) -(exception: #export (label_has_already_been_set {label Label}) +(exception: .public (label_has_already_been_set {label Label}) (exception.report ["Label" (%.nat label)])) -(exception: #export (mismatched_environments {instruction Name} +(exception: .public (mismatched_environments {instruction Name} {label Label} {address Address} {expected Stack} @@ -132,7 +132,7 @@ tracker)] [..relative_identity []]]))] - (def: #export (set_label label) + (def: .public (set_label label) (-> Label (Bytecode Any)) (function (_ [pool environment tracker]) (let [@here (get@ #program_counter tracker)] @@ -153,7 +153,7 @@ environment)] <success>)))))) -(def: #export monad +(def: .public monad (Monad Bytecode) (<| (:as (Monad Bytecode)) (writer.with ..relative_monoid) @@ -162,15 +162,15 @@ (: (Monad Try)) try.monad)) -(def: #export failure +(def: .public failure (-> Text Bytecode) (|>> #try.Failure function.constant)) -(def: #export (except exception value) +(def: .public (except exception value) (All [e] (-> (exception.Exception e) e Bytecode)) (..failure (exception.error exception value))) -(def: #export (resolve environment bytecode) +(def: .public (resolve environment bytecode) (All [a] (-> Environment (Bytecode a) (Resource [Environment (Row Exception) Instruction a]))) (function (_ pool) (do try.monad @@ -221,7 +221,7 @@ ) (template [<name> <consumption> <production> <registry> <instruction>] - [(def: #export <name> + [(def: .public <name> (Bytecode Any) (..bytecode <consumption> <production> @@ -416,7 +416,7 @@ []]])))) (template [<name> <consumption> <instruction>] - [(def: #export <name> + [(def: .public <name> (Bytecode Any) (do ..monad [_ (..bytecode <consumption> $0 @_ <instruction> [])] @@ -432,7 +432,7 @@ [athrow $1 _.athrow] ) -(def: #export (bipush byte) +(def: .public (bipush byte) (-> S1 (Bytecode Any)) (..bytecode $0 $1 @_ _.bipush [byte])) @@ -447,7 +447,7 @@ [..relative_identity output]])))) -(def: #export (string value) +(def: .public (string value) (-> //constant.UTF8 (Bytecode Any)) (do ..monad [index (..lift (//constant/pool.string value))] @@ -467,7 +467,7 @@ (#static doubleToRawLongBits #manual [double] long)]) (template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> (Bytecode Any)) (case (|> value <to_lux>) (^template [<special> <instruction>] @@ -514,7 +514,7 @@ (def: negative_zero_float_bits (|> -0.0 (:as java/lang/Double) ffi.double_to_float ..float_bits)) -(def: #export (float value) +(def: .public (float value) (-> java/lang/Float (Bytecode Any)) (if (i.= ..negative_zero_float_bits (..float_bits value)) @@ -529,7 +529,7 @@ _ (..arbitrary_float value)))) (template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] - [(def: #export (<name> value) + [(def: .public (<name> value) (-> <type> (Bytecode Any)) (case (|> value <to_lux>) (^template [<special> <instruction>] @@ -560,7 +560,7 @@ (def: negative_zero_double_bits (..double_bits (:as java/lang/Double -0.0))) -(def: #export (double value) +(def: .public (double value) (-> java/lang/Double (Bytecode Any)) (if (i.= ..negative_zero_double_bits (..double_bits value)) @@ -573,7 +573,7 @@ _ (..arbitrary_double value)))) -(exception: #export (invalid_register {id Nat}) +(exception: .public (invalid_register {id Nat}) (exception.report ["ID" (%.nat id)])) @@ -587,7 +587,7 @@ (..except ..invalid_register [id]))) (template [<for> <size> <name> <general> <specials>] - [(def: #export (<name> local) + [(def: .public (<name> local) (-> Nat (Bytecode Any)) (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local @@ -627,7 +627,7 @@ ) (template [<for> <size> <name> <general> <specials>] - [(def: #export (<name> local) + [(def: .public (<name> local) (-> Nat (Bytecode Any)) (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local @@ -667,7 +667,7 @@ ) (template [<consumption> <production> <name> <instruction> <input>] - [(def: #export <name> + [(def: .public <name> (-> <input> (Bytecode Any)) (..bytecode <consumption> <production> @_ <instruction>))] @@ -675,11 +675,11 @@ [$0 $1 sipush _.sipush S2] ) -(exception: #export (unknown_label {label Label}) +(exception: .public (unknown_label {label Label}) (exception.report ["Label" (%.nat label)])) -(exception: #export (cannot_do_a_big_jump {label Label} +(exception: .public (cannot_do_a_big_jump {label Label} {@from Address} {jump Big_Jump}) (exception.report @@ -703,7 +703,7 @@ (\ ! map (|>> #.Left) (//signed.s4 jump)) (\ ! map (|>> #.Right) (//signed.s2 jump)))))) -(exception: #export (unset_label {label Label}) +(exception: .public (unset_label {label Label}) (exception.report ["Label" (%.nat label)])) @@ -729,7 +729,7 @@ (update@ #known (dictionary.put label [stack #.None]) tracker))) (template [<consumption> <name> <instruction>] - [(def: #export (<name> label) + [(def: .public (<name> label) (-> Label (Bytecode Any)) (let [[estimator bytecode] <instruction>] (function (_ [pool environment tracker]) @@ -781,7 +781,7 @@ ) (template [<name> <instruction> <on_long_jump> <on_short_jump>] - [(def: #export (<name> label) + [(def: .public (<name> label) (-> Label (Bytecode Any)) (let [[estimator bytecode] <instruction>] (function (_ [pool environment tracker]) @@ -833,9 +833,9 @@ (#.Right small) (/jump.lift small))) -(exception: #export invalid_tableswitch) +(exception: .public invalid_tableswitch) -(def: #export (tableswitch minimum default [at_minimum afterwards]) +(def: .public (tableswitch minimum default [at_minimum afterwards]) (-> S4 Label [Label (List Label)] (Bytecode Any)) (let [[estimator bytecode] _.tableswitch] (function (_ [pool environment tracker]) @@ -872,9 +872,9 @@ (exception.except ..invalid_tableswitch [])))) []]])))))) -(exception: #export invalid_lookupswitch) +(exception: .public invalid_lookupswitch) -(def: #export (lookupswitch default cases) +(def: .public (lookupswitch default cases) (-> Label (List [S4 Label]) (Bytecode Any)) (let [cases (list.sort (function (_ [left _] [right _]) (i.< (//signed.value left) @@ -920,7 +920,7 @@ (|>> type.reflection reflection.reflection)) (template [<consumption> <production> <name> <category> <instruction>] - [(def: #export (<name> class) + [(def: .public (<name> class) (-> (Type <category>) (Bytecode Any)) (do ..monad [## TODO: Make sure it's impossible to have indexes greater than U2. @@ -933,16 +933,16 @@ [$1 $1 instanceof Object _.instanceof] ) -(def: #export (iinc register increase) +(def: .public (iinc register increase) (-> Nat U1 (Bytecode Any)) (do ..monad [register (..register register)] (..bytecode $0 $0 (/registry.for register) _.iinc [register increase]))) -(exception: #export (multiarray_cannot_be_zero_dimensional {class (Type Object)}) +(exception: .public (multiarray_cannot_be_zero_dimensional {class (Type Object)}) (exception.report ["Class" (..reflection class)])) -(def: #export (multianewarray class dimensions) +(def: .public (multianewarray class dimensions) (-> (Type Object) U1 (Bytecode Any)) (do ..monad [_ (: (Bytecode Any) @@ -965,7 +965,7 @@ 1)) (template [<static?> <name> <instruction> <method>] - [(def: #export (<name> class method type) + [(def: .public (<name> class method type) (-> (Type Class) Text (Type Method) (Bytecode Any)) (let [[type_variables inputs output exceptions] (parser.method type)] (do ..monad @@ -991,7 +991,7 @@ ) (template [<consumption> <name> <1> <2>] - [(def: #export (<name> class field type) + [(def: .public (<name> class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do ..monad [index (<| ..lift @@ -1009,12 +1009,12 @@ [$2 putfield _.putfield/1 _.putfield/2] ) -(exception: #export (invalid_range_for_try {start Address} {end Address}) +(exception: .public (invalid_range_for_try {start Address} {end Address}) (exception.report ["Start" (|> start /address.value //unsigned.value %.nat)] ["End" (|> end /address.value //unsigned.value %.nat)])) -(def: #export (try @start @end @handler catch) +(def: .public (try @start @end @handler catch) (-> Label Label Label (Type Class) (Bytecode Any)) (do ..monad [@catch (..lift (//constant/pool.class (//name.internal (..reflection catch))))] @@ -1038,7 +1038,7 @@ _.empty]))) []]])))) -(def: #export (compose pre post) +(def: .public (compose pre post) (All [pre post] (-> (Bytecode pre) (Bytecode post) (Bytecode post))) (do ..monad diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index 8a42afb41..d7f2f612f 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -23,18 +23,20 @@ ["#." unsigned (#+ U2)] ["#." signed (#+ S4)]]]]) -(abstract: #export Address +(abstract: .public Address + {} + U2 - (def: #export value + (def: .public value (-> Address U2) (|>> :representation)) - (def: #export start + (def: .public start Address (|> 0 ///unsigned.u2 try.assumed :abstraction)) - (def: #export (move distance) + (def: .public (move distance) (-> U2 (-> Address (Try Address))) (|>> :representation (///unsigned.+/2 distance) @@ -44,19 +46,19 @@ (-> Address (Try S4)) (|>> :representation ///unsigned.value .int ///signed.s4)) - (def: #export (jump from to) + (def: .public (jump from to) (-> Address Address (Try Big_Jump)) (do try.monad [from (with_sign from) to (with_sign to)] (///signed.-/4 from to))) - (def: #export (after? reference subject) + (def: .public (after? reference subject) (-> Address Address Bit) (n.> (|> reference :representation ///unsigned.value) (|> subject :representation ///unsigned.value))) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Address) (def: (= reference subject) @@ -64,11 +66,11 @@ (:representation reference) (:representation subject)))) - (def: #export writer + (def: .public writer (Writer Address) (|>> :representation ///unsigned.writer/2)) - (def: #export format + (def: .public format (Format Address) (|>> :representation ///unsigned.value %.nat)) ) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux index 6fbdadfa3..d426726e3 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux @@ -17,12 +17,12 @@ [type (#+ Type) [category (#+ Method)]]]]) -(type: #export Environment +(type: .public Environment {#limit Limit #stack (Maybe Stack)}) (template [<name> <limit>] - [(def: #export (<name> type) + [(def: .public (<name> type) (-> (Type Method) (Try Environment)) (do try.monad [limit (<limit> type)] @@ -33,10 +33,10 @@ [virtual /limit.virtual] ) -(type: #export Condition +(type: .public Condition (-> Environment (Try Environment))) -(implementation: #export monoid +(implementation: .public monoid (Monoid Condition) (def: identity (|>> #try.Success)) @@ -47,9 +47,9 @@ [environment (left environment)] (right environment))))) -(exception: #export discontinuity) +(exception: .public discontinuity) -(def: #export (stack environment) +(def: .public (stack environment) (-> Environment (Try Stack)) (case (get@ #..stack environment) (#.Some stack) @@ -58,17 +58,17 @@ #.None (exception.except ..discontinuity []))) -(def: #export discontinue +(def: .public discontinue (-> Environment Environment) (set@ #..stack #.None)) -(exception: #export (mismatched_stacks {expected Stack} +(exception: .public (mismatched_stacks {expected Stack} {actual Stack}) (exception.report ["Expected" (/stack.format expected)] ["Actual" (/stack.format actual)])) -(def: #export (continue expected environment) +(def: .public (continue expected environment) (-> Stack Environment (Try [Stack Environment])) (case (get@ #..stack environment) (#.Some actual) @@ -79,7 +79,7 @@ #.None (#try.Success [expected (set@ #..stack (#.Some expected) environment)]))) -(def: #export (consumes amount) +(def: .public (consumes amount) (-> U2 Condition) ## TODO: Revisit this definition once lenses/optics have been implemented, ## since it can probably be simplified with them. @@ -89,7 +89,7 @@ current (/stack.pop amount previous)] (in (set@ #..stack (#.Some current) environment))))) -(def: #export (produces amount) +(def: .public (produces amount) (-> U2 Condition) (function (_ environment) (do try.monad @@ -102,7 +102,7 @@ (set@ #..stack (#.Some current)) (set@ [#..limit #/limit.stack] limit)))))) -(def: #export (has registry) +(def: .public (has registry) (-> Registry Condition) (|>> (update@ [#..limit #/limit.registry] (/registry.has registry)) #try.Success)) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux index fad7c9dae..d8117947e 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux @@ -20,12 +20,12 @@ [type (#+ Type) [category (#+ Method)]]]]) -(type: #export Limit +(type: .public Limit {#stack Stack #registry Registry}) (template [<name> <registry>] - [(def: #export (<name> type) + [(def: .public (<name> type) (-> (Type Method) (Try Limit)) (do try.monad [registry (<registry> type)] @@ -36,21 +36,21 @@ [virtual /registry.virtual] ) -(def: #export length +(def: .public length ($_ n.+ ## u2 max_stack; /stack.length ## u2 max_locals; /registry.length)) -(def: #export equivalence +(def: .public equivalence (Equivalence Limit) ($_ product.equivalence /stack.equivalence /registry.equivalence )) -(def: #export (writer limit) +(def: .public (writer limit) (Writer Limit) ($_ format\compose (/stack.writer (get@ #stack limit)) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 3773b4333..7db606a0b 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -22,15 +22,17 @@ [category (#+ Method)] ["#/." parser]]]) -(type: #export Register U1) +(type: .public Register U1) (def: normal 1) (def: wide 2) -(abstract: #export Registry +(abstract: .public Registry + {} + U2 - (def: #export registry + (def: .public registry (-> U2 Registry) (|>> :abstraction)) @@ -46,7 +48,7 @@ (list\fold n.+ 0)))) (template [<start> <name>] - [(def: #export <name> + [(def: .public <name> (-> (Type Method) (Try Registry)) (|>> ..minimal (n.+ <start>) @@ -57,24 +59,24 @@ [1 virtual] ) - (def: #export equivalence + (def: .public equivalence (Equivalence Registry) (\ equivalence.functor map (|>> :representation) /////unsigned.equivalence)) - (def: #export writer + (def: .public writer (Writer Registry) (|>> :representation /////unsigned.writer/2)) - (def: #export (has needed) + (def: .public (has needed) (-> Registry Registry Registry) (|>> :representation (/////unsigned.max/2 (:representation needed)) :abstraction)) (template [<name> <extra>] - [(def: #export <name> + [(def: .public <name> (-> Register Registry) (let [extra (|> <extra> /////unsigned.u2 try.assumed)] (|>> /////unsigned.lift/2 @@ -87,5 +89,5 @@ ) ) -(def: #export length +(def: .public length /////unsigned.bytes/2) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux index 99a560347..a825e6699 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux @@ -17,11 +17,13 @@ [encoding ["#." unsigned (#+ U2)]]]) -(abstract: #export Stack +(abstract: .public Stack + {} + U2 (template [<frames> <name>] - [(def: #export <name> + [(def: .public <name> Stack (|> <frames> /////unsigned.u2 maybe.assume :abstraction))] @@ -29,13 +31,13 @@ [1 catch] ) - (def: #export equivalence + (def: .public equivalence (Equivalence Stack) (\ equivalence.functor map (|>> :representation) /////unsigned.equivalence)) - (def: #export writer + (def: .public writer (Writer Stack) (|>> :representation /////unsigned.writer/2)) @@ -44,7 +46,7 @@ (|>> :abstraction)) (template [<op> <name>] - [(def: #export (<name> amount) + [(def: .public (<name> amount) (-> U2 (-> Stack (Try Stack))) (|>> :representation (<op> amount) @@ -54,16 +56,16 @@ [/////unsigned.-/2 pop] ) - (def: #export (max left right) + (def: .public (max left right) (-> Stack Stack Stack) (:abstraction (/////unsigned.max/2 (:representation left) (:representation right)))) - (def: #export format + (def: .public format (Format Stack) (|>> :representation /////unsigned.value %.nat)) ) -(def: #export length +(def: .public length /////unsigned.bytes/2) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 3302b60dc..5aee5816a 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -36,23 +36,23 @@ [type [category (#+ Value Method)]]]]) -(type: #export Size U2) +(type: .public Size U2) -(type: #export Estimator +(type: .public Estimator (-> Address Size)) (def: fixed (-> Size Estimator) function.constant) -(type: #export Instruction +(type: .public Instruction (-> Specification Specification)) -(def: #export empty +(def: .public empty Instruction function.identity) -(def: #export run +(def: .public run (-> Instruction Specification) (function.apply format.no_op)) @@ -232,7 +232,9 @@ [(n.+ (///unsigned.value ..size/211) size) (|>> mutation ((trinary/211' opcode input0 input1 input2)))])]) -(abstract: #export Primitive_Array_Type +(abstract: .public Primitive_Array_Type + {} + U1 (def: code @@ -240,7 +242,7 @@ (|>> :representation)) (template [<code> <name>] - [(def: #export <name> (|> <code> ///unsigned.u1 try.assumed :abstraction))] + [(def: .public <name> (|> <code> ///unsigned.u1 try.assumed :abstraction))] [04 t_boolean] [05 t_char] @@ -491,7 +493,7 @@ [<input_name>] <inputs>')] - (def: #export <name> + (def: .public <name> [Estimator (-> [<input_types>] Instruction)] (let [[estimator <arity>'] <arity>] [estimator @@ -582,7 +584,7 @@ (n.- (n.% 4 parameter_start) 4)))) -(def: #export tableswitch +(def: .public tableswitch [(-> Nat Estimator) (-> S4 Big_Jump [Big_Jump (List Big_Jump)] Instruction)] (let [estimator (: (-> Nat Estimator) @@ -646,7 +648,7 @@ size) (|>> mutation tableswitch_mutation)]))))])) -(def: #export lookupswitch +(def: .public lookupswitch [(-> Nat Estimator) (-> Big_Jump (List [S4 Big_Jump]) Instruction)] (let [case_size (n.+ (///unsigned.value ..integer_size) @@ -706,7 +708,7 @@ size) (|>> mutation lookupswitch_mutation)]))))])) -(implementation: #export monoid +(implementation: .public monoid (Monoid Instruction) (def: identity ..empty) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux index 2873ef781..53fdd6081 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux @@ -10,18 +10,18 @@ [encoding ["#." signed (#+ S2 S4)]]]) -(type: #export Jump S2) +(type: .public Jump S2) -(def: #export equivalence +(def: .public equivalence (Equivalence Jump) ///signed.equivalence) -(def: #export writer +(def: .public writer (Writer Jump) ///signed.writer/2) -(type: #export Big_Jump S4) +(type: .public Big_Jump S4) -(def: #export lift +(def: .public lift (-> Jump Big_Jump) ///signed.lift/4) diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 2e4b8eb15..17561fa0d 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- public private) [abstract [equivalence (#+ Equivalence)] ["." monad (#+ do)]] @@ -27,7 +27,7 @@ ["#." constant (#+ Constant) ["#/." pool (#+ Pool Resource)]]]) -(type: #export #rec Class +(type: .public #rec Class {#magic Magic #minor_version Minor #major_version Major @@ -51,7 +51,7 @@ ["4000" enum] ) -(def: #export equivalence +(def: .public equivalence (Equivalence Class) ($_ product.equivalence //unsigned.equivalence @@ -81,7 +81,7 @@ interfaces))] (in [@this @super @interfaces]))) -(def: #export (class version modifier +(def: .public (class version modifier this super interfaces fields methods attributes) (-> Major (Modifier Class) @@ -110,7 +110,7 @@ #methods (row.of_list =methods) #attributes attributes}))) -(def: #export (writer class) +(def: .public (writer class) (Writer Class) (`` ($_ binaryF\compose (~~ (template [<writer> <slot>] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 7f2a7aa26..229dd247f 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -34,24 +34,26 @@ [encoding ["#." unsigned]]]]) -(type: #export UTF8 Text) +(type: .public UTF8 Text) (def: utf8_writer (Writer UTF8) binaryF.utf8/16) -(abstract: #export Class +(abstract: .public Class + {} + (Index UTF8) - (def: #export index + (def: .public index (-> Class (Index UTF8)) (|>> :representation)) - (def: #export class + (def: .public class (-> (Index UTF8) Class) (|>> :abstraction)) - (def: #export class_equivalence + (def: .public class_equivalence (Equivalence Class) (\ equivalence.functor map ..index @@ -66,7 +68,7 @@ ["#::." (#static floatToRawIntBits #manual [float] int)]) -(implementation: #export float_equivalence +(implementation: .public float_equivalence (Equivalence java/lang/Float) (def: (= parameter subject) @@ -82,14 +84,16 @@ ["#::." (#static doubleToRawLongBits [double] long)]) -(abstract: #export (Value kind) +(abstract: .public (Value kind) + {} + kind - (def: #export value + (def: .public value (All [kind] (-> (Value kind) kind)) (|>> :representation)) - (def: #export (value_equivalence Equivalence<kind>) + (def: .public (value_equivalence Equivalence<kind>) (All [kind] (-> (Equivalence kind) (Equivalence (Value kind)))) @@ -98,9 +102,9 @@ Equivalence<kind>)) (template [<constructor> <type> <marker>] - [(type: #export <type> (Value <marker>)) + [(type: .public <type> (Value <marker>)) - (def: #export <constructor> + (def: .public <constructor> (-> <marker> <type>) (|>> :abstraction))] @@ -126,16 +130,16 @@ ) ) -(type: #export (Name_And_Type of) +(type: .public (Name_And_Type of) {#name (Index UTF8) #descriptor (Index (Descriptor of))}) -(type: #export (Reference of) +(type: .public (Reference of) {#class (Index Class) #name_and_type (Index (Name_And_Type of))}) (template [<type> <equivalence> <writer>] - [(def: #export <equivalence> + [(def: .public <equivalence> (Equivalence (<type> Any)) ($_ product.equivalence //index.equivalence @@ -151,7 +155,7 @@ [Reference reference_equivalence reference_writer] ) -(type: #export Constant +(type: .public Constant (#UTF8 UTF8) (#Integer Integer) (#Float Float) @@ -164,7 +168,7 @@ (#Interface_Method (Reference //category.Method)) (#Name_And_Type (Name_And_Type Any))) -(def: #export (size constant) +(def: .public (size constant) (-> Constant Nat) (case constant (^or (#Long _) (#Double _)) @@ -173,7 +177,7 @@ _ 1)) -(def: #export equivalence +(def: .public equivalence (Equivalence Constant) ## TODO: Delete the explicit "implementation" and use the combinator ## version below as soon as the new format for variants is implemented. @@ -219,7 +223,7 @@ ## ) ) -(def: #export writer +(def: .public writer (Writer Constant) (with_expansions [<constants> (as_is [#UTF8 /tag.utf8 ..utf8_writer] [#Integer /tag.integer ..integer_writer] diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index d050b1e34..a82683e1b 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -35,59 +35,59 @@ [category (#+ Value Method)] ["#." descriptor (#+ Descriptor)]]]]) -(type: #export Pool [Index (Row [Index Constant])]) +(type: .public Pool [Index (Row [Index Constant])]) -(def: #export equivalence +(def: .public equivalence (Equivalence Pool) (product.equivalence //index.equivalence (row.equivalence (product.equivalence //index.equivalence //.equivalence)))) -(type: #export (Resource a) +(type: .public (Resource a) (+State Try Pool a)) -(def: #export monad +(def: .public monad (Monad Resource) (state.with try.monad)) (template: (!add <tag> <equivalence> <value>) - (function (_ [current pool]) - (let [<value>' <value>] - (with_expansions [<try_again> (as_is (recur (.inc idx)))] - (loop [idx 0] - (case (row.item idx pool) - (#try.Success entry) - (case entry - [index (<tag> reference)] - (if (\ <equivalence> = reference <value>') - (#try.Success [[current pool] - index]) - <try_again>) - - _ - <try_again>) - - (#try.Failure _) - (let [new (<tag> <value>')] - (do {! try.monad} - [@new (//unsigned.u2 (//.size new)) - next (: (Try Index) - (|> current - //index.value - (//unsigned.+/2 @new) - (\ ! map //index.index)))] - (in [[next - (row.add [current new] pool)] - current]))))))))) + [(function (_ [current pool]) + (let [<value>' <value>] + (with_expansions [<try_again> (as_is (recur (.inc idx)))] + (loop [idx 0] + (case (row.item idx pool) + (#try.Success entry) + (case entry + [index (<tag> reference)] + (if (\ <equivalence> = reference <value>') + (#try.Success [[current pool] + index]) + <try_again>) + + _ + <try_again>) + + (#try.Failure _) + (let [new (<tag> <value>')] + (do {! try.monad} + [@new (//unsigned.u2 (//.size new)) + next (: (Try Index) + (|> current + //index.value + (//unsigned.+/2 @new) + (\ ! map //index.index)))] + (in [[next + (row.add [current new] pool)] + current]))))))))]) (template: (!index <index>) - (|> <index> //index.value //unsigned.value)) + [(|> <index> //index.value //unsigned.value)]) (type: (Adder of) (-> of (Resource (Index of)))) (template [<name> <type> <tag> <equivalence>] - [(def: #export (<name> value) + [(def: .public (<name> value) (Adder <type>) (!add <tag> <equivalence> value))] @@ -98,32 +98,32 @@ [utf8 UTF8 #//.UTF8 text.equivalence] ) -(def: #export (string value) +(def: .public (string value) (-> Text (Resource (Index String))) (do ..monad [@value (utf8 value) .let [value (//.string @value)]] (!add #//.String (//.value_equivalence //index.equivalence) value))) -(def: #export (class name) +(def: .public (class name) (-> Internal (Resource (Index Class))) (do ..monad [@name (utf8 (//name.read name)) .let [value (//.class @name)]] (!add #//.Class //.class_equivalence value))) -(def: #export (descriptor value) +(def: .public (descriptor value) (All [kind] (-> (Descriptor kind) (Resource (Index (Descriptor kind))))) (let [value (//descriptor.descriptor value)] (!add #//.UTF8 text.equivalence value))) -(type: #export (Member of) +(type: .public (Member of) {#name UTF8 #descriptor (Descriptor of)}) -(def: #export (name_and_type [name descriptor]) +(def: .public (name_and_type [name descriptor]) (All [of] (-> (Member of) (Resource (Index (Name_And_Type of))))) (do ..monad @@ -132,7 +132,7 @@ (!add #//.Name_And_Type //.name_and_type_equivalence {#//.name @name #//.descriptor @descriptor}))) (template [<name> <tag> <of>] - [(def: #export (<name> class member) + [(def: .public (<name> class member) (-> External (Member <of>) (Resource (Index (Reference <of>)))) (do ..monad [@class (..class (//name.internal class)) @@ -144,7 +144,7 @@ [interface_method #//.Interface_Method Method] ) -(def: #export writer +(def: .public writer (Writer Pool) (function (_ [next pool]) (row\fold (function (_ [_index post] pre) @@ -152,7 +152,7 @@ (format.bits/16 (!index next)) pool))) -(def: #export empty +(def: .public empty Pool [(|> 1 //unsigned.u2 try.assumed //index.index) row.empty]) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 0eba9788e..7d53837f0 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -14,17 +14,19 @@ [encoding ["#." unsigned (#+ U1) ("u1//." equivalence)]]]) -(abstract: #export Tag +(abstract: .public Tag + {} + U1 - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Tag) (def: (= reference sample) (u1//= (:representation reference) (:representation sample)))) (template [<code> <name>] - [(def: #export <name> + [(def: .public <name> Tag (|> <code> ///unsigned.u1 try.assumed :abstraction))] @@ -44,7 +46,7 @@ [18 invoke_dynamic] ) - (def: #export writer + (def: .public writer (Writer Tag) (|>> :representation ///unsigned.writer/1)) ) diff --git a/stdlib/source/library/lux/target/jvm/encoding/name.lux b/stdlib/source/library/lux/target/jvm/encoding/name.lux index 02507ceb6..a0761950e 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux @@ -7,34 +7,36 @@ [type abstract]]]) -(def: #export internal_separator "/") -(def: #export external_separator ".") +(def: .public internal_separator "/") +(def: .public external_separator ".") -(type: #export External Text) +(type: .public External Text) -(abstract: #export Internal +(abstract: .public Internal + {} + Text - (def: #export internal + (def: .public internal (-> External Internal) (|>> (text.replace_all ..external_separator ..internal_separator) :abstraction)) - (def: #export read + (def: .public read (-> Internal Text) (|>> :representation)) - (def: #export external + (def: .public external (-> Internal External) (|>> :representation (text.replace_all ..internal_separator ..external_separator)))) -(def: #export safe +(def: .public safe (-> Text External) (|>> ..internal ..external)) -(def: #export (qualify package class) +(def: .public (qualify package class) (-> Text External External) (format (..safe package) ..external_separator class)) diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index dfdcedbb6..196f60380 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -22,26 +22,28 @@ [type abstract]]]) -(abstract: #export (Signed brand) +(abstract: .public (Signed brand) + {} + Int - (def: #export value + (def: .public value (-> (Signed Any) Int) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Signed brand))) (def: (= reference sample) (i.= (:representation reference) (:representation sample)))) - (implementation: #export order + (implementation: .public order (All [brand] (Order (Signed brand))) (def: &equivalence ..equivalence) (def: (< reference sample) (i.< (:representation reference) (:representation sample)))) - (exception: #export (value_exceeds_the_scope {value Int} + (exception: .public (value_exceeds_the_scope {value Int} {scope Nat}) (exception.report ["Value" (%.int value)] @@ -49,16 +51,16 @@ (template [<bytes> <name> <size> <constructor> <maximum> <+> <->] [(with_expansions [<raw> (template.identifier [<name> "'"])] - (abstract: #export <raw> Any) - (type: #export <name> (Signed <raw>))) + (abstract: .public <raw> {} Any) + (type: .public <name> (Signed <raw>))) - (def: #export <size> <bytes>) + (def: .public <size> <bytes>) - (def: #export <maximum> + (def: .public <maximum> <name> (|> <bytes> (n.* i64.bits_per_byte) dec i64.mask :abstraction)) - (def: #export <constructor> + (def: .public <constructor> (-> Int (Try <name>)) (let [positive (|> <bytes> (n.* i64.bits_per_byte) i64.mask) negative (|> positive .int (i.right_shifted 1) i64.not)] @@ -71,7 +73,7 @@ (exception.except ..value_exceeds_the_scope [value <size>]))))) (template [<abstract_operation> <concrete_operation>] - [(def: #export (<abstract_operation> parameter subject) + [(def: .public (<abstract_operation> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> (<concrete_operation> (:representation parameter) @@ -87,7 +89,7 @@ ) (template [<name> <from> <to>] - [(def: #export <name> + [(def: .public <name> (-> <from> <to>) (|>> :transmutation))] @@ -96,7 +98,7 @@ ) (template [<writer_name> <type> <writer>] - [(def: #export <writer_name> + [(def: .public <writer_name> (Writer <type>) (|>> :representation <writer>))] diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index 546d4f516..e9084bb9d 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -21,20 +21,22 @@ [type abstract]]]) -(abstract: #export (Unsigned brand) +(abstract: .public (Unsigned brand) + {} + Nat - (def: #export value + (def: .public value (-> (Unsigned Any) Nat) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [brand] (Equivalence (Unsigned brand))) (def: (= reference sample) (n.= (:representation reference) (:representation sample)))) - (implementation: #export order + (implementation: .public order (All [brand] (Order (Unsigned brand))) (def: &equivalence ..equivalence) @@ -42,7 +44,7 @@ (n.< (:representation reference) (:representation sample)))) - (exception: #export (value_exceeds_the_maximum {type Name} + (exception: .public (value_exceeds_the_maximum {type Name} {value Nat} {maximum (Unsigned Any)}) (exception.report @@ -50,7 +52,7 @@ ["Value" (%.nat value)] ["Maximum" (%.nat (:representation maximum))])) - (exception: #export [brand] (subtraction_cannot_yield_negative_value + (exception: .public [brand] (subtraction_cannot_yield_negative_value {type Name} {parameter (Unsigned brand)} {subject (Unsigned brand)}) @@ -61,28 +63,28 @@ (template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>] [(with_expansions [<raw> (template.identifier [<name> "'"])] - (abstract: #export <raw> Any) - (type: #export <name> (Unsigned <raw>))) + (abstract: .public <raw> {} Any) + (type: .public <name> (Unsigned <raw>))) - (def: #export <size> <bytes>) + (def: .public <size> <bytes>) - (def: #export <maximum> + (def: .public <maximum> <name> (|> <bytes> (n.* i64.bits_per_byte) i64.mask :abstraction)) - (def: #export (<constructor> value) + (def: .public (<constructor> value) (-> Nat (Try <name>)) (if (n.<= (:representation <maximum>) value) (#try.Success (:abstraction value)) (exception.except ..value_exceeds_the_maximum [(name_of <name>) value <maximum>]))) - (def: #export (<+> parameter subject) + (def: .public (<+> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> (n.+ (:representation parameter) (:representation subject)))) - (def: #export (<-> parameter subject) + (def: .public (<-> parameter subject) (-> <name> <name> (Try <name>)) (let [parameter' (:representation parameter) subject' (:representation subject)] @@ -90,7 +92,7 @@ (#try.Success (:abstraction (n.- parameter' subject'))) (exception.except ..subtraction_cannot_yield_negative_value [(name_of <name>) parameter subject])))) - (def: #export (<max> left right) + (def: .public (<max> left right) (-> <name> <name> <name>) (:abstraction (n.max (:representation left) (:representation right))))] @@ -101,7 +103,7 @@ ) (template [<name> <from> <to>] - [(def: #export <name> + [(def: .public <name> (-> <from> <to>) (|>> :transmutation))] @@ -110,7 +112,7 @@ ) (template [<writer_name> <type> <writer>] - [(def: #export <writer_name> + [(def: .public <writer_name> (Writer <type>) (|>> :representation <writer>))] diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux index 93cda4c5e..a9d783621 100644 --- a/stdlib/source/library/lux/target/jvm/field.lux +++ b/stdlib/source/library/lux/target/jvm/field.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Type static) + [lux (#- Type static public private) [abstract [equivalence (#+ Equivalence)] ["." monad (#+ do)]] @@ -20,7 +20,7 @@ [category (#+ Value)] [descriptor (#+ Descriptor)]]]) -(type: #export #rec Field +(type: .public #rec Field {#modifier (Modifier Field) #name (Index UTF8) #descriptor (Index (Descriptor Value)) @@ -38,7 +38,7 @@ ["4000" enum] ) -(def: #export equivalence +(def: .public equivalence (Equivalence Field) ($_ product.equivalence modifier.equivalence @@ -46,7 +46,7 @@ //index.equivalence (row.equivalence //attribute.equivalence))) -(def: #export (writer field) +(def: .public (writer field) (Writer Field) (`` ($_ binaryF\compose (~~ (template [<writer> <slot>] @@ -58,7 +58,7 @@ [(binaryF.row/16 //attribute.writer) #attributes])) ))) -(def: #export (field modifier name type attributes) +(def: .public (field modifier name type attributes) (-> (Modifier Field) UTF8 (Type Value) (Row Attribute) (Resource Field)) (do //constant/pool.monad diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux index 851d6903f..66df65314 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -12,27 +12,29 @@ [encoding ["#." unsigned (#+ U2)]]]) -(def: #export length +(def: .public length //unsigned.bytes/2) -(abstract: #export (Index kind) +(abstract: .public (Index kind) + {} + U2 - (def: #export index + (def: .public index (All [kind] (-> U2 (Index kind))) (|>> :abstraction)) - (def: #export value + (def: .public value (-> (Index Any) U2) (|>> :representation)) - (def: #export equivalence + (def: .public equivalence (All [kind] (Equivalence (Index kind))) (\ equivalence.functor map ..value //unsigned.equivalence)) - (def: #export writer + (def: .public writer (All [kind] (Writer (Index kind))) (|>> :representation //unsigned.writer/2)) ) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index ec7931743..3a38d9bb8 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -19,18 +19,18 @@ ["." array] ["." dictionary (#+ Dictionary)]]]]]) -(type: #export Library +(type: .public Library (Atom (Dictionary Text Binary))) -(exception: #export (already_stored {class Text}) +(exception: .public (already_stored {class Text}) (exception.report ["Class" class])) -(exception: #export (unknown {class Text}) +(exception: .public (unknown {class Text}) (exception.report ["Class" class])) -(exception: #export (cannot_define {class Text} {error Text}) +(exception: .public (cannot_define {class Text} {error Text}) (exception.report ["Class" class] ["Error" error])) @@ -78,7 +78,7 @@ (ffi.class_for java/lang/ClassLoader)) (java/lang/reflect/AccessibleObject::setAccessible true))))) -(def: #export (define class_name bytecode loader) +(def: .public (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) (let [signature (array.of_list (list (:as java/lang/Object class_name) @@ -95,11 +95,11 @@ ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) -(def: #export (new_library _) +(def: .public (new_library _) (-> Any Library) (atom.atom (dictionary.empty text.hash))) -(def: #export (memory library) +(def: .public (memory library) (-> Library java/lang/ClassLoader) (with_expansions [<cast> (for {@.old (<|) @@ -126,7 +126,7 @@ #.None (error! (exception.error ..unknown [class_name]))))))))) -(def: #export (store name bytecode library) +(def: .public (store name bytecode library) (-> Text Binary Library (IO (Try Any))) (do {! io.monad} [library' (atom.read library)] @@ -136,7 +136,7 @@ [_ (atom.update (dictionary.put name bytecode) library)] (in (#try.Success [])))))) -(def: #export (load name loader) +(def: .public (load name loader) (-> Text java/lang/ClassLoader (IO (Try (java/lang/Class java/lang/Object)))) (java/lang/ClassLoader::loadClass name loader)) diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux index fee2c425a..c08360f9e 100644 --- a/stdlib/source/library/lux/target/jvm/magic.lux +++ b/stdlib/source/library/lux/target/jvm/magic.lux @@ -9,12 +9,12 @@ [encoding ["#." unsigned (#+ U4)]]]) -(type: #export Magic +(type: .public Magic U4) -(def: #export code +(def: .public code Magic (|> (hex "CAFEBABE") //unsigned.u4 try.assumed)) -(def: #export writer +(def: .public writer //unsigned.writer/4) diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index a2868b2ac..54aee2e60 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Type static) + [lux (#- Type static public private) [abstract [equivalence (#+ Equivalence)] ["." monad (#+ do)]] @@ -26,7 +26,7 @@ ["#/." category] ["#." descriptor (#+ Descriptor)]]]) -(type: #export #rec Method +(type: .public #rec Method {#modifier (Modifier Method) #name (Index UTF8) #descriptor (Index (Descriptor //type/category.Method)) @@ -47,7 +47,7 @@ ["1000" synthetic] ) -(def: #export (method modifier name type attributes code) +(def: .public (method modifier name type attributes code) (-> (Modifier Method) UTF8 (Type //type/category.Method) (List (Resource Attribute)) (Maybe (Bytecode Any)) (Resource Method)) (do {! //constant/pool.monad} @@ -82,7 +82,7 @@ #descriptor @descriptor #attributes attributes}))) -(def: #export equivalence +(def: .public equivalence (Equivalence Method) ($_ product.equivalence //modifier.equivalence @@ -91,7 +91,7 @@ (row.equivalence //attribute.equivalence) )) -(def: #export (writer field) +(def: .public (writer field) (Writer Method) (`` ($_ format\compose (~~ (template [<writer> <slot>] diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index d6fae89ed..92aeafec2 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -23,14 +23,16 @@ [encoding ["#." unsigned]]]) -(abstract: #export (Modifier of) +(abstract: .public (Modifier of) + {} + //unsigned.U2 - (def: #export code + (def: .public code (-> (Modifier Any) //unsigned.U2) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [of] (Equivalence (Modifier of))) (def: (= reference sample) @@ -39,24 +41,24 @@ (:representation sample)))) (template: (!wrap value) - (|> value - //unsigned.u2 - try.assumed - :abstraction)) + [(|> value + //unsigned.u2 + try.assumed + :abstraction)]) (template: (!unwrap value) - (|> value - :representation - //unsigned.value)) + [(|> value + :representation + //unsigned.value)]) - (def: #export (has? sub super) + (def: .public (has? sub super) (All [of] (-> (Modifier of) (Modifier of) Bit)) (let [sub (!unwrap sub)] (|> (!unwrap super) (i64.and sub) (\ i64.equivalence = sub)))) - (implementation: #export monoid + (implementation: .public monoid (All [of] (Monoid (Modifier of))) (def: identity @@ -65,11 +67,11 @@ (def: (compose left right) (!wrap (i64.or (!unwrap left) (!unwrap right))))) - (def: #export empty + (def: .public empty Modifier (\ ..monoid identity)) - (def: #export writer + (def: .public writer (All [of] (Writer (Modifier of))) (|>> :representation //unsigned.writer/2)) @@ -78,10 +80,10 @@ (|>> !wrap)) ) -(syntax: #export (modifiers: ofT {options (<>.many <c>.any)}) +(syntax: .public (modifiers: ofT {options (<>.many <c>.any)}) (with_gensyms [g!modifier g!code] (in (list (` (template [(~ g!code) (~ g!modifier)] - [(def: (~' #export) (~ g!modifier) + [(def: (~' .public) (~ g!modifier) (..Modifier (~ ofT)) ((~! ..modifier) ((~! number.hex) (~ g!code))))] diff --git a/stdlib/source/library/lux/target/jvm/modifier/inner.lux b/stdlib/source/library/lux/target/jvm/modifier/inner.lux index fc9bc982c..6a7e9ae7c 100644 --- a/stdlib/source/library/lux/target/jvm/modifier/inner.lux +++ b/stdlib/source/library/lux/target/jvm/modifier/inner.lux @@ -5,7 +5,7 @@ abstract]]] [// (#+ modifiers:)]) -(abstract: #export Inner Any) +(abstract: .public Inner {} Any) (modifiers: Inner ["0001" public] diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 6827f2be9..bdb8249f2 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -111,12 +111,12 @@ (getConstructors [] [(java/lang/reflect/Constructor java/lang/Object)]) (getDeclaredMethods [] [java/lang/reflect/Method])]) -(exception: #export (unknown_class {class External}) +(exception: .public (unknown_class {class External}) (exception.report ["Class" (%.text class)])) (template [<name>] - [(exception: #export (<name> {jvm_type java/lang/reflect/Type}) + [(exception: .public (<name> {jvm_type java/lang/reflect/Type}) (exception.report ["Type" (java/lang/reflect/Type::getTypeName jvm_type)] ["Class" (|> jvm_type java/lang/Object::getClass java/lang/Object::toString)]))] @@ -125,7 +125,7 @@ [cannot_convert_to_a_lux_type] ) -(def: #export (load class_loader name) +(def: .public (load class_loader name) (-> java/lang/ClassLoader External (Try (java/lang/Class java/lang/Object))) (case (java/lang/Class::forName name false class_loader) (#try.Success class) @@ -134,7 +134,7 @@ (#try.Failure _) (exception.except ..unknown_class name))) -(def: #export (sub? class_loader super sub) +(def: .public (sub? class_loader super sub) (-> java/lang/ClassLoader External External (Try Bit)) (do try.monad [super (..load class_loader super) @@ -187,7 +187,7 @@ ## else (exception.except ..cannot_convert_to_a_lux_type reflection))) -(def: #export (parameter reflection) +(def: .public (parameter reflection) (-> java/lang/reflect/Type (Try (/.Type Parameter))) (<| (case (ffi.check java/lang/reflect/TypeVariable reflection) (#.Some reflection) @@ -217,12 +217,12 @@ _) (..class' parameter reflection))) -(def: #export class +(def: .public class (-> java/lang/reflect/Type (Try (/.Type Class))) (..class' ..parameter)) -(def: #export (type reflection) +(def: .public (type reflection) (-> java/lang/reflect/Type (Try (/.Type Value))) (<| (case (ffi.check java/lang/Class reflection) (#.Some reflection) @@ -256,7 +256,7 @@ ## else (..parameter reflection))) -(def: #export (return reflection) +(def: .public (return reflection) (-> java/lang/reflect/Type (Try (/.Type Return))) (with_expansions [<else> (as_is (..type reflection))] (case (ffi.check java/lang/Class reflection) @@ -272,13 +272,13 @@ #.None <else>))) -(exception: #export (cannot_correspond {class (java/lang/Class java/lang/Object)} +(exception: .public (cannot_correspond {class (java/lang/Class java/lang/Object)} {type Type}) (exception.report ["Class" (java/lang/Object::toString class)] ["Type" (%.type type)])) -(exception: #export (type_parameter_mismatch {expected Nat} +(exception: .public (type_parameter_mismatch {expected Nat} {actual Nat} {class (java/lang/Class java/lang/Object)} {type Type}) @@ -288,11 +288,11 @@ ["Class" (java/lang/Object::toString class)] ["Type" (%.type type)])) -(exception: #export (non_jvm_type {type Type}) +(exception: .public (non_jvm_type {type Type}) (exception.report ["Type" (%.type type)])) -(def: #export (correspond class type) +(def: .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (case type (#.Primitive name params) @@ -326,7 +326,7 @@ _ (exception.except ..non_jvm_type [type]))) -(exception: #export (mistaken_field_owner {field java/lang/reflect/Field} +(exception: .public (mistaken_field_owner {field java/lang/reflect/Field} {owner (java/lang/Class java/lang/Object)} {target (java/lang/Class java/lang/Object)}) (exception.report @@ -335,7 +335,7 @@ ["Target" (java/lang/Object::toString target)])) (template [<name>] - [(exception: #export (<name> {field Text} + [(exception: .public (<name> {field Text} {class (java/lang/Class java/lang/Object)}) (exception.report ["Field" (%.text field)] @@ -346,7 +346,7 @@ [not_a_virtual_field] ) -(def: #export (field field target) +(def: .public (field field target) (-> Text (java/lang/Class java/lang/Object) (Try java/lang/reflect/Field)) (case (java/lang/Class::getDeclaredField field target) (#try.Success field) @@ -358,7 +358,7 @@ (#try.Failure _) (exception.except ..unknown_field [field target]))) -(def: #export deprecated? +(def: .public deprecated? (-> (array.Array java/lang/annotation/Annotation) Bit) (|>> array.list (list.all (|>> (ffi.check java/lang/Deprecated))) @@ -366,7 +366,7 @@ not)) (template [<name> <exception> <then?> <else?>] - [(def: #export (<name> field class) + [(def: .public (<name> field class) (-> Text (java/lang/Class java/lang/Object) (Try [Bit Bit (/.Type Value)])) (do {! try.monad} [fieldJ (..field field class) diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index 9b29382c7..c4a5abd0b 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -24,22 +24,24 @@ ["#." descriptor (#+ Descriptor)] ["#." reflection (#+ Reflection)]]) -(abstract: #export (Type category) +(abstract: .public (Type category) + {} + [(Signature category) (Descriptor category) (Reflection category)] - (type: #export Argument + (type: .public Argument [Text (Type Value)]) - (type: #export (Typed a) + (type: .public (Typed a) [(Type Value) a]) - (type: #export Constraint + (type: .public Constraint {#name Text #super_class (Type Class) #super_interfaces (List (Type Class))}) (template [<name> <style>] - [(def: #export (<name> type) + [(def: .public (<name> type) (All [category] (-> (Type category) (<style> category))) (let [[signature descriptor reflection] (:representation type)] <name>))] @@ -48,7 +50,7 @@ [descriptor Descriptor] ) - (def: #export (reflection type) + (def: .public (reflection type) (All [category] (-> (Type (<| Return' Value' category)) (Reflection (<| Return' Value' category)))) @@ -56,7 +58,7 @@ reflection)) (template [<category> <name> <signature> <descriptor> <reflection>] - [(def: #export <name> + [(def: .public <name> (Type <category>) (:abstraction [<signature> <descriptor> <reflection>]))] @@ -71,28 +73,28 @@ [Primitive char /signature.char /descriptor.char /reflection.char] ) - (def: #export (array type) + (def: .public (array type) (-> (Type Value) (Type Array)) (:abstraction [(/signature.array (..signature type)) (/descriptor.array (..descriptor type)) (/reflection.array (..reflection type))])) - (def: #export (class name parameters) + (def: .public (class name parameters) (-> External (List (Type Parameter)) (Type Class)) (:abstraction [(/signature.class name (list\map ..signature parameters)) (/descriptor.class name) (/reflection.class name)])) - (def: #export (declaration name variables) + (def: .public (declaration name variables) (-> External (List (Type Var)) (Type Declaration)) (:abstraction [(/signature.declaration name (list\map ..signature variables)) (/descriptor.declaration name) (/reflection.declaration name)])) - (def: #export (as_class type) + (def: .public (as_class type) (-> (Type Declaration) (Type Class)) (:abstraction (let [[signature descriptor reflection] (:representation type)] @@ -100,21 +102,21 @@ (/descriptor.as_class descriptor) (/reflection.as_class reflection)]))) - (def: #export wildcard + (def: .public wildcard (Type Parameter) (:abstraction [/signature.wildcard /descriptor.wildcard /reflection.wildcard])) - (def: #export (var name) + (def: .public (var name) (-> Text (Type Var)) (:abstraction [(/signature.var name) /descriptor.var /reflection.var])) - (def: #export (lower bound) + (def: .public (lower bound) (-> (Type Class) (Type Parameter)) (:abstraction (let [[signature descriptor reflection] (:representation bound)] @@ -122,7 +124,7 @@ (/descriptor.lower descriptor) (/reflection.lower reflection)]))) - (def: #export (upper bound) + (def: .public (upper bound) (-> (Type Class) (Type Parameter)) (:abstraction (let [[signature descriptor reflection] (:representation bound)] @@ -130,7 +132,7 @@ (/descriptor.upper descriptor) (/reflection.upper reflection)]))) - (def: #export (method [type_variables inputs output exceptions]) + (def: .public (method [type_variables inputs output exceptions]) (-> [(List (Type Var)) (List (Type Value)) (Type Return) @@ -145,7 +147,7 @@ (..descriptor output)]) (:assume ..void)])) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Type category))) (def: (= parameter subject) @@ -153,13 +155,13 @@ (..signature parameter) (..signature subject)))) - (implementation: #export hash + (implementation: .public hash (All [category] (Hash (Type category))) (def: &equivalence ..equivalence) (def: hash (|>> ..signature (\ /signature.hash hash)))) - (def: #export (primitive? type) + (def: .public (primitive? type) (-> (Type Value) (Either (Type Object) (Type Primitive))) (if (`` (or (~~ (template [<type>] @@ -176,7 +178,7 @@ (|> type (:as (Type Primitive)) #.Right) (|> type (:as (Type Object)) #.Left))) - (def: #export (void? type) + (def: .public (void? type) (-> (Type Return) (Either (Type Value) (Type Void))) (if (`` (or (~~ (template [<type>] @@ -187,7 +189,7 @@ (|> type (:as (Type Value)) #.Left))) ) -(def: #export (class? type) +(def: .public (class? type) (-> (Type Value) (Maybe External)) (let [repr (|> type ..descriptor /descriptor.descriptor)] (if (and (text.starts_with? /descriptor.class_prefix repr) @@ -202,6 +204,6 @@ (\ maybe.monad map (|>> //name.internal //name.external)))) #.None))) -(def: #export format +(def: .public format (All [a] (Format (Type a))) (|>> ..signature /signature.signature)) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index e4c4ccca3..05ecd1f29 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -24,10 +24,10 @@ [encoding ["#." name]]]]) -(type: #export Aliasing +(type: .public Aliasing (Dictionary Text Text)) -(def: #export fresh +(def: .public fresh Aliasing (dictionary.empty text.hash)) @@ -115,7 +115,7 @@ (\ <>.monad map //.var) (<>.before (<>.many (..bound aliasing))))) -(def: #export (method aliasing) +(def: .public (method aliasing) (-> Aliasing (-> (Type Method) (Type Method))) (|>> //.signature //signature.signature diff --git a/stdlib/source/library/lux/target/jvm/type/box.lux b/stdlib/source/library/lux/target/jvm/type/box.lux index 9479ef218..44ab2a6ee 100644 --- a/stdlib/source/library/lux/target/jvm/type/box.lux +++ b/stdlib/source/library/lux/target/jvm/type/box.lux @@ -6,7 +6,7 @@ [name (#+ External)]]]) (template [<name> <box>] - [(def: #export <name> External <box>)] + [(def: .public <name> External <box>)] [boolean "java.lang.Boolean"] [byte "java.lang.Byte"] diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index 7f492290d..c42a007f2 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -6,25 +6,25 @@ [type abstract]]]) -(abstract: #export Void' Any) -(abstract: #export (Value' kind) Any) -(abstract: #export (Return' kind) Any) -(abstract: #export Method Any) +(abstract: .public Void' {} Any) +(abstract: .public (Value' kind) {} Any) +(abstract: .public (Return' kind) {} Any) +(abstract: .public Method {} Any) -(type: #export Return (<| Return' Any)) -(type: #export Value (<| Return' Value' Any)) -(type: #export Void (<| Return' Void')) +(type: .public Return (<| Return' Any)) +(type: .public Value (<| Return' Value' Any)) +(type: .public Void (<| Return' Void')) -(abstract: #export (Object' brand) Any) -(type: #export Object (<| Return' Value' Object' Any)) +(abstract: .public (Object' brand) {} Any) +(type: .public Object (<| Return' Value' Object' Any)) -(abstract: #export (Parameter' brand) Any) -(type: #export Parameter (<| Return' Value' Object' Parameter' Any)) +(abstract: .public (Parameter' brand) {} Any) +(type: .public Parameter (<| Return' Value' Object' Parameter' Any)) (template [<parents> <child>] [(with_expansions [<raw> (template.identifier [<child> "'"])] - (abstract: #export <raw> Any) - (type: #export <child> + (abstract: .public <raw> {} Any) + (type: .public <child> (`` (<| Return' Value' (~~ (template.spliced <parents>)) <raw>))))] [[] Primitive] @@ -33,4 +33,4 @@ [[Object'] Array] ) -(abstract: #export Declaration Any) +(abstract: .public Declaration {} Any) diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux index 6f36f544b..df751407b 100644 --- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux @@ -20,15 +20,17 @@ [encoding ["#." name (#+ Internal External)]]]]) -(abstract: #export (Descriptor category) +(abstract: .public (Descriptor category) + {} + Text - (def: #export descriptor + (def: .public descriptor (-> (Descriptor Any) Text) (|>> :representation)) (template [<sigil> <category> <name>] - [(def: #export <name> + [(def: .public <name> (Descriptor <category>) (:abstraction <sigil>))] @@ -43,26 +45,26 @@ ["C" Primitive char] ) - (def: #export class_prefix "L") - (def: #export class_suffix ";") + (def: .public class_prefix "L") + (def: .public class_suffix ";") - (def: #export class + (def: .public class (-> External (Descriptor Class)) (|>> ///name.internal ///name.read (text.enclosed [..class_prefix ..class_suffix]) :abstraction)) - (def: #export (declaration name) + (def: .public (declaration name) (-> External (Descriptor Declaration)) (:transmutation (..class name))) - (def: #export as_class + (def: .public as_class (-> (Descriptor Declaration) (Descriptor Class)) (|>> :transmutation)) (template [<name> <category>] - [(def: #export <name> + [(def: .public <name> (Descriptor <category>) (:transmutation (..class "java.lang.Object")))] @@ -71,24 +73,24 @@ [wildcard Parameter] ) - (def: #export (lower descriptor) + (def: .public (lower descriptor) (-> (Descriptor Class) (Descriptor Parameter)) ..wildcard) - (def: #export upper + (def: .public upper (-> (Descriptor Class) (Descriptor Parameter)) (|>> :transmutation)) - (def: #export array_prefix "[") + (def: .public array_prefix "[") - (def: #export array + (def: .public array (-> (Descriptor Value) (Descriptor Array)) (|>> :representation (format ..array_prefix) :abstraction)) - (def: #export (method [inputs output]) + (def: .public (method [inputs output]) (-> [(List (Descriptor Value)) (Descriptor Return)] (Descriptor Method)) @@ -99,13 +101,13 @@ (text.enclosed ["(" ")"])) (:representation output)))) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Descriptor category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) - (def: #export class_name + (def: .public class_name (-> (Descriptor Object) Internal) (let [prefix_size (text.size ..class_prefix) suffix_size (text.size ..class_suffix)] diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index 86184ebbd..5a58e3dc0 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -30,19 +30,19 @@ ["#." name]]]]) (template [<name>] - [(abstract: #export (<name> class) Any)] + [(abstract: .public (<name> class) {} Any)] [Lower] [Upper] ) -(type: #export Mapping +(type: .public Mapping (Dictionary Text Type)) -(def: #export fresh +(def: .public fresh Mapping (dictionary.empty text.hash)) -(exception: #export (unknown_var {var Text}) +(exception: .public (unknown_var {var Text}) (exception.report ["Var" (%.text var)])) @@ -165,7 +165,7 @@ class ))))) -(def: #export class +(def: .public class (-> Mapping (Parser (Check Type))) (|>> ..parameter ..class')) @@ -192,7 +192,7 @@ (|> elementT array.Array .type))))) (<>.after (<text>.this //descriptor.array_prefix)))) -(def: #export (type mapping) +(def: .public (type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) @@ -202,7 +202,7 @@ (..array type) )))) -(def: #export (boxed_type mapping) +(def: .public (boxed_type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) @@ -212,21 +212,21 @@ (..array type) )))) -(def: #export (return mapping) +(def: .public (return mapping) (-> Mapping (Parser (Check Type))) ($_ <>.either ..void (..type mapping) )) -(def: #export (boxed_return mapping) +(def: .public (boxed_return mapping) (-> Mapping (Parser (Check Type))) ($_ <>.either ..void (..boxed_type mapping) )) -(def: #export (check operation input) +(def: .public (check operation input) (All [a] (-> (Parser (Check a)) Text (Check a))) (case (<text>.run operation input) (#try.Success check) diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index 5dbada115..f54b961cc 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -23,7 +23,7 @@ ["#." name (#+ External)]]]]) (template [<category> <name> <signature> <type>] - [(def: #export <name> + [(def: .public <name> (Parser (Type <category>)) (<>.after (<text>.this (//signature.signature <signature>)) (<>\in <type>)))] @@ -40,7 +40,7 @@ [Parameter wildcard //signature.wildcard //.wildcard] ) -(def: #export primitive +(def: .public primitive (Parser (Type Primitive)) ($_ <>.either ..boolean @@ -66,7 +66,7 @@ (format var/tail //name.internal_separator)) (template [<type> <name> <head> <tail> <adapter>] - [(def: #export <name> + [(def: .public <name> (Parser <type>) (\ <>.functor map <adapter> (<text>.slice (<text>.and! (<text>.one_of! <head>) @@ -76,24 +76,24 @@ [Text var_name var/head var/tail function.identity] ) -(def: #export var' +(def: .public var' (Parser Text) (|> ..var_name (<>.after (<text>.this //signature.var_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: #export var +(def: .public var (Parser (Type Var)) (<>\map //.var ..var')) -(def: #export var? +(def: .public var? (-> (Type Value) (Maybe Text)) (|>> //.signature //signature.signature (<text>.run ..var') try.maybe)) -(def: #export name +(def: .public name (-> (Type Var) Text) (|>> //.signature //signature.signature @@ -127,7 +127,7 @@ (|>> ..class'' (\ <>.monad map (product.uncurry //.class)))) -(def: #export parameter +(def: .public parameter (Parser (Type Parameter)) (<>.rec (function (_ parameter) @@ -140,17 +140,17 @@ class ))))) -(def: #export array' +(def: .public array' (-> (Parser (Type Value)) (Parser (Type Array))) (|>> (<>.after (<text>.this //descriptor.array_prefix)) (<>\map //.array))) -(def: #export class +(def: .public class (Parser (Type Class)) (..class' ..parameter)) (template [<name> <prefix> <constructor>] - [(def: #export <name> + [(def: .public <name> (-> (Type Value) (Maybe (Type Class))) (|>> //.signature //signature.signature @@ -161,14 +161,14 @@ [upper? //signature.upper_prefix //.upper] ) -(def: #export read_class +(def: .public read_class (-> (Type Class) [External (List (Type Parameter))]) (|>> //.signature //signature.signature (<text>.run (..class'' ..parameter)) try.assumed)) -(def: #export value +(def: .public value (Parser (Type Value)) (<>.rec (function (_ value) @@ -178,11 +178,11 @@ (..array' value) )))) -(def: #export array +(def: .public array (Parser (Type Array)) (..array' ..value)) -(def: #export object +(def: .public object (Parser (Type Object)) ($_ <>.either ..class @@ -193,7 +193,7 @@ (<>.after (<text>.this //signature.arguments_start)) (<>.before (<text>.this //signature.arguments_end)))) -(def: #export return +(def: .public return (Parser (Type Return)) (<>.either ..void ..value)) @@ -203,7 +203,7 @@ (|> (..class' ..parameter) (<>.after (<text>.this //signature.exception_prefix)))) -(def: #export method +(def: .public method (-> (Type Method) [(List (Type Var)) (List (Type Value)) @@ -227,7 +227,7 @@ try.assumed))) (template [<name> <category> <parser>] - [(def: #export <name> + [(def: .public <name> (-> (Type Value) (Maybe <category>)) (|>> //.signature //signature.signature @@ -247,7 +247,7 @@ [object? (Type Object) ..object] ) -(def: #export declaration' +(def: .public declaration' (Parser [External (List (Type Var))]) (|> (<>.and ..class_name (|> (<>.some ..var) @@ -257,7 +257,7 @@ (<>.after (<text>.this //descriptor.class_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: #export declaration +(def: .public declaration (-> (Type Declaration) [External (List (Type Var))]) (|>> //.signature //signature.signature diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux index 78ef5a45c..f92b41ae5 100644 --- a/stdlib/source/library/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux @@ -15,21 +15,23 @@ [encoding ["#." name (#+ External)]]]]) -(abstract: #export (Reflection category) +(abstract: .public (Reflection category) + {} + Text - (def: #export reflection + (def: .public reflection (-> (Reflection Any) Text) (|>> :representation)) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Reflection category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) (template [<category> <name> <reflection>] - [(def: #export <name> + [(def: .public <name> (Reflection <category>) (:abstraction <reflection>))] @@ -44,19 +46,19 @@ [Primitive char "char"] ) - (def: #export class + (def: .public class (-> External (Reflection Class)) (|>> :abstraction)) - (def: #export (declaration name) + (def: .public (declaration name) (-> External (Reflection Declaration)) (:transmutation (..class name))) - (def: #export as_class + (def: .public as_class (-> (Reflection Declaration) (Reflection Class)) (|>> :transmutation)) - (def: #export (array element) + (def: .public (array element) (-> (Reflection Value) (Reflection Array)) (let [element' (:representation element) elementR (`` (cond (text.starts_with? //descriptor.array_prefix element') @@ -85,7 +87,7 @@ :abstraction))) (template [<name> <category>] - [(def: #export <name> + [(def: .public <name> (Reflection <category>) (:transmutation (..class "java.lang.Object")))] @@ -94,11 +96,11 @@ [wildcard Parameter] ) - (def: #export (lower reflection) + (def: .public (lower reflection) (-> (Reflection Class) (Reflection Parameter)) ..wildcard) - (def: #export upper + (def: .public upper (-> (Reflection Class) (Reflection Parameter)) (|>> :transmutation)) ) diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index 84a6a5982..4ebdb9248 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -18,15 +18,17 @@ [encoding ["#." name (#+ External)]]]]) -(abstract: #export (Signature category) +(abstract: .public (Signature category) + {} + Text - (def: #export signature + (def: .public signature (-> (Signature Any) Text) (|>> :representation)) (template [<category> <name> <descriptor>] - [(def: #export <name> + [(def: .public <name> (Signature <category>) (:abstraction (//descriptor.descriptor <descriptor>)))] @@ -41,34 +43,34 @@ [Primitive char //descriptor.char] ) - (def: #export array + (def: .public array (-> (Signature Value) (Signature Array)) (|>> :representation (format //descriptor.array_prefix) :abstraction)) - (def: #export wildcard + (def: .public wildcard (Signature Parameter) (:abstraction "*")) - (def: #export var_prefix "T") + (def: .public var_prefix "T") - (def: #export var + (def: .public var (-> Text (Signature Var)) (|>> (text.enclosed [..var_prefix //descriptor.class_suffix]) :abstraction)) - (def: #export var_name + (def: .public var_name (-> (Signature Var) Text) (|>> :representation (text.replace_all ..var_prefix "") (text.replace_all //descriptor.class_suffix ""))) - (def: #export lower_prefix "-") - (def: #export upper_prefix "+") + (def: .public lower_prefix "-") + (def: .public upper_prefix "+") (template [<name> <prefix>] - [(def: #export <name> + [(def: .public <name> (-> (Signature Class) (Signature Parameter)) (|>> :representation (format <prefix>) :abstraction))] @@ -76,10 +78,10 @@ [upper ..upper_prefix] ) - (def: #export parameters_start "<") - (def: #export parameters_end ">") + (def: .public parameters_start "<") + (def: .public parameters_end ">") - (def: #export (class name parameters) + (def: .public (class name parameters) (-> External (List (Signature Parameter)) (Signature Class)) (:abstraction (format //descriptor.class_prefix @@ -96,25 +98,25 @@ ..parameters_end)) //descriptor.class_suffix))) - (def: #export (declaration name variables) + (def: .public (declaration name variables) (-> External (List (Signature Var)) (Signature Declaration)) (:transmutation (..class name variables))) - (def: #export as_class + (def: .public as_class (-> (Signature Declaration) (Signature Class)) (|>> :transmutation)) - (def: #export arguments_start "(") - (def: #export arguments_end ")") + (def: .public arguments_start "(") + (def: .public arguments_end ")") - (def: #export exception_prefix "^") + (def: .public exception_prefix "^") (def: class_bound (|> (..class "java.lang.Object" (list)) ..signature (format ":"))) - (def: #export (method [type_variables inputs output exceptions]) + (def: .public (method [type_variables inputs output exceptions]) (-> [(List (Signature Var)) (List (Signature Value)) (Signature Return) @@ -141,14 +143,14 @@ (list\map (|>> :representation (format ..exception_prefix))) (text.join_with ""))))) - (implementation: #export equivalence + (implementation: .public equivalence (All [category] (Equivalence (Signature category))) (def: (= parameter subject) (text\= (:representation parameter) (:representation subject)))) - (implementation: #export hash + (implementation: .public hash (All [category] (Hash (Signature category))) (def: &equivalence ..equivalence) diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux index d22ca84e2..f5db348ef 100644 --- a/stdlib/source/library/lux/target/jvm/version.lux +++ b/stdlib/source/library/lux/target/jvm/version.lux @@ -7,16 +7,16 @@ [encoding ["#." unsigned (#+ U2)]]]) -(type: #export Version U2) -(type: #export Minor Version) -(type: #export Major Version) +(type: .public Version U2) +(type: .public Minor Version) +(type: .public Major Version) -(def: #export default_minor +(def: .public default_minor Minor (|> 0 //unsigned.u2 try.assumed)) (template [<number> <name>] - [(def: #export <name> + [(def: .public <name> Major (|> <number> //unsigned.u2 try.assumed))] @@ -34,5 +34,5 @@ [56 v12] ) -(def: #export writer +(def: .public writer //unsigned.writer/2) |