diff options
author | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
commit | 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 (patch) | |
tree | 115fab5bd8a5f53dc0d13ce5453095324a83496f /stdlib/source/library/lux/target/jvm | |
parent | f92c806ee8da63f04bbefbf558f6249bacdb47ea (diff) |
De-sigil-ification: suffix : [Part 13]
Diffstat (limited to 'stdlib/source/library/lux/target/jvm')
35 files changed, 420 insertions, 420 deletions
diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 30a3fe5f3..eb6fd8566 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -35,7 +35,7 @@ #length U4 #info about])) -(def: .public (info_equivalence Equivalence<about>) +(def .public (info_equivalence Equivalence<about>) (All (_ about) (-> (Equivalence about) (Equivalence (Info about)))) @@ -44,7 +44,7 @@ //unsigned.equivalence Equivalence<about>)) -(def: (info_writer writer) +(def (info_writer writer) (All (_ about) (-> (Writer about) (Writer (Info about)))) @@ -67,7 +67,7 @@ <Code>) ) -(def: .public equivalence +(def .public equivalence (Equivalence Attribute) (equivalence.rec (function (_ equivalence) @@ -77,7 +77,7 @@ (info_equivalence //index.equivalence) )))) -(def: common_attribute_length +(def common_attribute_length (all n.+ ... u2 attribute_name_index; //unsigned.bytes/2 @@ -85,7 +85,7 @@ //unsigned.bytes/4 )) -(def: (length attribute) +(def (length attribute) (-> Attribute Nat) (case attribute (^.with_template [<tag>] @@ -96,19 +96,19 @@ [#Signature]))) ... TODO: Inline ASAP -(def: (constant' index @name) +(def (constant' index @name) (-> (Constant Any) (Index UTF8) Attribute) {#Constant [#name @name ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.2 #length (|> /constant.length //unsigned.u4 try.trusted) #info index]}) -(def: .public (constant index) +(def .public (constant index) (-> (Constant Any) (Resource Attribute)) (//pool#each (constant' index) (//pool.utf8 "ConstantValue"))) ... TODO: Inline ASAP -(def: (code' specification @name) +(def (code' specification @name) (-> Code (Index UTF8) Attribute) {#Code [#name @name ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 @@ -118,26 +118,26 @@ try.trusted) #info specification]}) -(def: .public (code specification) +(def .public (code specification) (-> Code (Resource Attribute)) (//pool#each (code' specification) (//pool.utf8 "Code"))) ... TODO: Inline ASAP -(def: (signature' it @name) +(def (signature' it @name) (-> (Index UTF8) (Index UTF8) Attribute) {#Signature [#name @name ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.9 #length (|> //index.length //unsigned.u4 try.trusted) #info it]}) -(def: .public (signature it) +(def .public (signature it) (All (_ category) (-> (Signature category) (Resource Attribute))) (do [! //pool.monad] [it (|> it //signature.signature //pool.utf8)] (at ! each (signature' it) (//pool.utf8 "Signature")))) -(def: .public (writer it) +(def .public (writer it) (Writer Attribute) (case it {#Constant it} diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index cc795b920..835b6726a 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -29,7 +29,7 @@ #exception_table (Sequence Exception) #attributes (Sequence Attribute)])) -(def: .public (length length code) +(def .public (length length code) (All (_ Attribute) (-> (-> Attribute Nat) (Code Attribute) Nat)) (all n.+ ... u2 max_stack; @@ -54,7 +54,7 @@ (sequence#each length) (sequence#mix n.+ 0)))) -(def: .public (equivalence attribute_equivalence) +(def .public (equivalence attribute_equivalence) (All (_ attribute) (-> (Equivalence attribute) (Equivalence (Code attribute)))) (all product.equivalence @@ -65,7 +65,7 @@ )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: .public (writer writer code) +(def .public (writer writer code) (All (_ Attribute) (-> (Writer Attribute) (Writer (Code Attribute)))) (all binaryF#composite ... 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 b71573669..f71d52cfd 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux @@ -26,7 +26,7 @@ #handler Address #catch (Index Class)])) -(def: .public equivalence +(def .public equivalence (Equivalence Exception) (all product.equivalence ////address.equivalence @@ -36,7 +36,7 @@ )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 -(def: .public length +(def .public length Nat (all n.+ ... u2 start_pc; @@ -49,7 +49,7 @@ ////unsigned.bytes/2 )) -(def: .public writer +(def .public writer (Writer Exception) (all \\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 6e20c2ad1..34c8582ca 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/constant.lux @@ -15,13 +15,13 @@ (type: .public (Constant a) (Index (Value a))) -(def: .public equivalence +(def .public equivalence (All (_ a) (Equivalence (Constant a))) ///index.equivalence) -(def: .public length +(def .public length ///index.length) -(def: .public 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 882c0dfdf..99901a4a3 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -64,7 +64,7 @@ #next Label #known Resolver])) -(def: fresh +(def fresh Tracker [#program_counter /address.start #next 0 @@ -73,16 +73,16 @@ (type: .public Relative (-> Resolver (Try [(Sequence Exception) Instruction]))) -(def: no_exceptions +(def no_exceptions (Sequence Exception) sequence.empty) -(def: relative#identity +(def relative#identity Relative (function (_ _) {try.#Success [..no_exceptions _.empty]})) -(def: try|do +(def try|do (template (_ <binding> <term> <then>) [(.case <term> {try.#Success <binding>} @@ -91,11 +91,11 @@ failure (as_expected failure))])) -(def: try|in +(def try|in (template (_ <it>) [{try.#Success <it>}])) -(def: (relative#composite left right) +(def (relative#composite left right) (-> Relative Relative Relative) (cond (same? ..relative#identity left) right @@ -110,16 +110,16 @@ (try|in [(at sequence.monoid composite left_exceptions right_exceptions) (_#composite left_instruction right_instruction)]))))) -(def: relative_monoid +(def relative_monoid (Monoid Relative) (implementation - (def: identity ..relative#identity) - (def: composite ..relative#composite))) + (def identity ..relative#identity) + (def composite ..relative#composite))) (type: .public (Bytecode a) (+State Try [Pool Environment Tracker] (Writer Relative a))) -(def: .public new_label +(def .public new_label (Bytecode Label) (function (_ [pool environment tracker]) {try.#Success [[pool @@ -144,7 +144,7 @@ "Expected" (/stack.format expected) "Actual" (/stack.format actual))) -(def: .public (set? label) +(def .public (set? label) (-> Label (Bytecode (Maybe [Stack Address]))) (function (_ state) (let [[pool environment tracker] state] @@ -157,7 +157,7 @@ _ {.#None})]]}))) -(def: .public (acknowledged? label) +(def .public (acknowledged? label) (-> Label (Bytecode (Maybe Stack))) (function (_ state) (let [[pool environment tracker] state] @@ -170,7 +170,7 @@ _ {.#None})]]}))) -(def: .public stack +(def .public stack (Bytecode (Maybe Stack)) (function (_ state) (let [[pool environment tracker] state] @@ -185,7 +185,7 @@ tracker)] [..relative#identity []]]))] - (def: .public (set_label label) + (def .public (set_label label) (-> Label (Bytecode Any)) (function (_ [pool environment tracker]) (let [@here (the #program_counter tracker)] @@ -205,10 +205,10 @@ environment)) <success>)))))) -(def: .public functor +(def .public functor (Functor Bytecode) (implementation - (def: (each $ it) + (def (each $ it) (function (_ state) (case (it state) {try.#Success [state' [relative it]]} @@ -218,16 +218,16 @@ failure (as_expected failure)))))) -(def: .public monad +(def .public monad (Monad Bytecode) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in it) + (def (in it) (function (_ state) {try.#Success [state [relative#identity it]]})) - (def: (conjoint ^^it) + (def (conjoint ^^it) (function (_ state) (case (^^it state) {try.#Success [state' [left ^it]]} @@ -243,7 +243,7 @@ failure (as_expected failure)))))) -(def: .public (when_continuous it) +(def .public (when_continuous it) (-> (Bytecode Any) (Bytecode Any)) (do ..monad [stack ..stack] @@ -255,7 +255,7 @@ _ (in [])))) -(def: .public (when_acknowledged @ it) +(def .public (when_acknowledged @ it) (-> Label (Bytecode Any) (Bytecode Any)) (do ..monad [?@ (..acknowledged? @)] @@ -267,27 +267,27 @@ _ (in [])))) -(def: .public (failure error) +(def .public (failure error) (-> Text Bytecode) (function (_ _) {try.#Failure error})) -(def: .public (except exception value) +(def .public (except exception value) (All (_ e) (-> (exception.Exception e) e Bytecode)) (..failure (exception.error exception value))) -(def: .public (resolve environment bytecode) +(def .public (resolve environment bytecode) (All (_ a) (-> Environment (Bytecode a) (Resource [Environment (Sequence Exception) Instruction a]))) (function (_ pool) (<| (try|do [[pool environment tracker] [relative output]] (bytecode [pool environment ..fresh])) (try|do [exceptions instruction] (relative (the #known tracker))) (try|in [pool [environment exceptions instruction output]])))) -(def: (step estimator counter) +(def (step estimator counter) (-> Estimator Address (Try Address)) (/address.move (estimator counter) counter)) -(def: (bytecode consumption production registry [estimator bytecode] input) +(def (bytecode consumption production registry [estimator bytecode] input) (All (_ a) (-> U2 U2 Registry [Estimator (-> [a] Instruction)] a (Bytecode Any))) (function (_ [pool environment tracker]) (<| (try|do environment' (|> environment @@ -304,7 +304,7 @@ []]])))) (with_template [<name> <frames>] - [(def: <name> U2 + [(def <name> U2 (|> <frames> //unsigned.u2 try.trusted))] [$0 0] @@ -317,7 +317,7 @@ ) (with_template [<name> <registry>] - [(def: <name> Registry (|> <registry> //unsigned.u2 try.trusted /registry.registry))] + [(def <name> Registry (|> <registry> //unsigned.u2 try.trusted /registry.registry))] [@_ 0] [@0 1] @@ -328,7 +328,7 @@ ) (with_template [<name> <consumption> <production> <registry> <instruction>] - [(def: .public <name> + [(def .public <name> (Bytecode Any) (..bytecode <consumption> <production> @@ -511,7 +511,7 @@ [monitorexit $1 $0 @_ _.monitorexit] ) -(def: discontinuity! +(def discontinuity! (Bytecode Any) (function (_ [pool environment tracker]) (<| (try|do _ (/environment.stack environment)) @@ -522,7 +522,7 @@ []]])))) (with_template [<name> <consumption> <instruction>] - [(def: .public <name> + [(def .public <name> (Bytecode Any) (do ..monad [_ (..bytecode <consumption> $0 @_ <instruction> [])] @@ -538,11 +538,11 @@ [athrow $1 _.athrow] ) -(def: .public (bipush byte) +(def .public (bipush byte) (-> S1 (Bytecode Any)) (..bytecode $0 $1 @_ _.bipush [byte])) -(def: (lifted resource) +(def (lifted resource) (All (_ a) (-> (Resource a) (Bytecode a))) @@ -552,7 +552,7 @@ [..relative#identity output]])))) -(def: .public (string value) +(def .public (string value) (-> //constant.UTF8 (Bytecode Any)) (do ..monad [index (..lifted (//constant/pool.string value))] @@ -572,7 +572,7 @@ ("static" doubleToRawLongBits "manual" [double] long)) (with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] - [(def: .public (<name> value) + [(def .public (<name> value) (-> <type> (Bytecode Any)) (case (|> value <to_lux>) (^.with_template [<special> <instruction>] @@ -599,7 +599,7 @@ [+5 _.iconst_5])] ) -(def: (arbitrary_float value) +(def (arbitrary_float value) (-> java/lang/Float (Bytecode Any)) (do ..monad [index (..lifted (//constant/pool.float (//constant.float value)))] @@ -610,16 +610,16 @@ {try.#Failure _} (..bytecode $0 $1 @_ _.ldc_w/float [index])))) -(def: float_bits +(def float_bits (-> java/lang/Float Int) (|>> java/lang/Float::floatToRawIntBits ffi.int_to_long (as Int))) -(def: negative_zero_float_bits +(def negative_zero_float_bits (|> -0.0 (as java/lang/Double) ffi.double_to_float ..float_bits)) -(def: .public (float value) +(def .public (float value) (-> java/lang/Float (Bytecode Any)) (if (i.= ..negative_zero_float_bits (..float_bits value)) @@ -634,7 +634,7 @@ _ (..arbitrary_float value)))) (with_template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] - [(def: .public (<name> value) + [(def .public (<name> value) (-> <type> (Bytecode Any)) (case (|> value <to_lux>) (^.with_template [<special> <instruction>] @@ -651,21 +651,21 @@ [+1 _.lconst_1])] ) -(def: (arbitrary_double value) +(def (arbitrary_double value) (-> java/lang/Double (Bytecode Any)) (do ..monad [index (..lifted (//constant/pool.double (//constant.double (as Frac value))))] (..bytecode $0 $2 @_ _.ldc2_w/double [index]))) -(def: double_bits +(def double_bits (-> java/lang/Double Int) (|>> java/lang/Double::doubleToRawLongBits (as Int))) -(def: negative_zero_double_bits +(def negative_zero_double_bits (..double_bits (as java/lang/Double -0.0))) -(def: .public (double value) +(def .public (double value) (-> java/lang/Double (Bytecode Any)) (if (i.= ..negative_zero_double_bits (..double_bits value)) @@ -682,7 +682,7 @@ (exception.report "ID" (%.nat id))) -(def: (register id) +(def (register id) (-> Nat (Bytecode Register)) (case (//unsigned.u1 id) {try.#Success register} @@ -692,7 +692,7 @@ (..except ..invalid_register [id]))) (with_template [<for> <size> <name> <general> <specials>] - [(def: .public (<name> local) + [(def .public (<name> local) (-> Nat (Bytecode Any)) (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local @@ -732,7 +732,7 @@ ) (with_template [<for> <size> <name> <general> <specials>] - [(def: .public (<name> local) + [(def .public (<name> local) (-> Nat (Bytecode Any)) (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local @@ -772,7 +772,7 @@ ) (with_template [<consumption> <production> <name> <instruction> <input>] - [(def: .public <name> + [(def .public <name> (-> <input> (Bytecode Any)) (..bytecode <consumption> <production> @_ <instruction>))] @@ -796,7 +796,7 @@ (Either Big_Jump Jump)) -(def: (jump @from @to) +(def (jump @from @to) (-> Address Address (Try Any_Jump)) (<| (try|do jump (try#each //signed.value (/address.jump @from @to))) @@ -812,7 +812,7 @@ (exception.report "Label" (%.nat label))) -(def: (resolve_label label resolver) +(def (resolve_label label resolver) (-> Label Resolver (Try [Stack Address])) (case (dictionary.value label resolver) {.#Some [actual {.#Some address}]} @@ -825,7 +825,7 @@ _ (exception.except ..unknown_label [label]))) -(def: (acknowledge_label stack label tracker) +(def (acknowledge_label stack label tracker) (-> Stack Label Tracker Tracker) (case (dictionary.value label (the #known tracker)) {.#Some _} @@ -836,7 +836,7 @@ (revised #known (dictionary.has label [stack {.#None}]) tracker))) (with_template [<consumption> <name> <instruction>] - [(def: .public (<name> label) + [(def .public (<name> label) (-> Label (Bytecode Any)) (let [[estimator bytecode] <instruction>] (function (_ [pool environment tracker]) @@ -886,7 +886,7 @@ ) (with_template [<name> <instruction> <on_long_jump> <on_short_jump>] - [(def: .public (<name> label) + [(def .public (<name> label) (-> Label (Bytecode Any)) (let [[estimator bytecode] <instruction>] (function (_ [pool environment tracker]) @@ -928,7 +928,7 @@ (try|in [..no_exceptions (bytecode (/jump.lifted jump))])] ) -(def: (big_jump jump) +(def (big_jump jump) (-> Any_Jump Big_Jump) (case jump {.#Left big} @@ -939,7 +939,7 @@ (exception: .public invalid_tableswitch) -(def: .public (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]) @@ -977,7 +977,7 @@ (exception: .public invalid_lookupswitch) -(def: .public (lookupswitch default cases) +(def .public (lookupswitch default cases) (-> Label (List [S4 Label]) (Bytecode Any)) (let [cases (list.sorted (function (_ [left _] [right _]) (i.< (//signed.value left) @@ -1016,13 +1016,13 @@ (exception.except ..invalid_lookupswitch [])))) []]])))))) -(def: reflection +(def reflection (All (_ category) (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) (with_template [<consumption> <production> <name> <category> <instruction>] - [(def: .public (<name> class) + [(def .public (<name> class) (-> (Type <category>) (Bytecode Any)) (do ..monad [... TODO: Make sure it's impossible to have indexes greater than U2. @@ -1035,7 +1035,7 @@ [$1 $1 instanceof Object _.instanceof] ) -(def: .public (iinc register increase) +(def .public (iinc register increase) (-> Nat U1 (Bytecode Any)) (do ..monad [register (..register register)] @@ -1045,7 +1045,7 @@ (exception.report "Class" (..reflection class))) -(def: .public (multianewarray class dimensions) +(def .public (multianewarray class dimensions) (-> (Type Object) U1 (Bytecode Any)) (do ..monad [_ (is (Bytecode Any) @@ -1055,7 +1055,7 @@ index (..lifted (//constant/pool.class (//name.internal (..reflection class))))] (..bytecode (//unsigned.lifted/2 dimensions) $1 @_ _.multianewarray [index dimensions]))) -(def: (type_size type) +(def (type_size type) (-> (Type Return) Nat) (cond (same? type.void type) 0 @@ -1068,7 +1068,7 @@ 1)) (with_template [<static?> <name> <instruction> <method>] - [(def: .public (<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 @@ -1094,7 +1094,7 @@ ) (with_template [<consumption> <name> <1> <2>] - [(def: .public (<name> class field type) + [(def .public (<name> class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do ..monad [index (<| ..lifted @@ -1111,7 +1111,7 @@ ) (with_template [<name> <consumption/1> <1> <consumption/2> <2>] - [(def: .public (<name> class field type) + [(def .public (<name> class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do [! ..monad] [index (<| ..lifted @@ -1133,7 +1133,7 @@ "Start" (|> start /address.value //unsigned.value %.nat) "End" (|> end /address.value //unsigned.value %.nat))) -(def: .public (try @start @end @handler catch) +(def .public (try @start @end @handler catch) (-> Label Label Label (Type Class) (Bytecode Any)) (do ..monad [@catch (..lifted (//constant/pool.class (//name.internal (..reflection catch))))] @@ -1157,7 +1157,7 @@ _.empty]))) []]]}))) -(def: .public (composite pre post) +(def .public (composite pre post) (All (_ pre post) (-> (Bytecode pre) (Bytecode post) (Bytecode post))) (function (_ state) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index ddb1331dc..5c2dd04d2 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -26,49 +26,49 @@ (primitive .public Address U2 - (def: .public value + (def .public value (-> Address U2) (|>> representation)) - (def: .public start + (def .public start Address (|> 0 ///unsigned.u2 try.trusted abstraction)) - (def: .public (move distance) + (def .public (move distance) (-> U2 (-> Address (Try Address))) (|>> representation (///unsigned.+/2 distance) (at try.functor each (|>> abstraction)))) - (def: with_sign + (def with_sign (-> Address (Try S4)) (|>> representation ///unsigned.value .int ///signed.s4)) - (def: .public (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: .public (after? reference subject) + (def .public (after? reference subject) (-> Address Address Bit) (n.> (|> reference representation ///unsigned.value) (|> subject representation ///unsigned.value))) - (def: .public equivalence + (def .public equivalence (Equivalence Address) (implementation - (def: (= reference subject) + (def (= reference subject) (at ///unsigned.equivalence = (representation reference) (representation subject))))) - (def: .public writer + (def .public writer (Writer Address) (|>> representation ///unsigned.writer/2)) - (def: .public 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 cc3ff123c..14e8d5543 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux @@ -23,7 +23,7 @@ #stack (Maybe Stack)])) (with_template [<name> <limit>] - [(def: .public (<name> type) + [(def .public (<name> type) (-> (Type Method) (Try Environment)) (do try.monad [limit (<limit> type)] @@ -37,13 +37,13 @@ (type: .public Condition (-> Environment (Try Environment))) -(def: .public monoid +(def .public monoid (Monoid Condition) (implementation - (def: identity + (def identity (|>> {try.#Success})) - (def: (composite left right) + (def (composite left right) (function (_ environment) (do try.monad [environment (left environment)] @@ -51,7 +51,7 @@ (exception: .public discontinuity) -(def: .public (stack environment) +(def .public (stack environment) (-> Environment (Try Stack)) (case (the ..#stack environment) {.#Some stack} @@ -60,7 +60,7 @@ {.#None} (exception.except ..discontinuity []))) -(def: .public discontinue +(def .public discontinue (-> Environment Environment) (.has ..#stack {.#None})) @@ -70,7 +70,7 @@ "Expected" (/stack.format expected) "Actual" (/stack.format actual))) -(def: .public (continue expected environment) +(def .public (continue expected environment) (-> Stack Environment (Try [Stack Environment])) (case (the ..#stack environment) {.#Some actual} @@ -81,7 +81,7 @@ {.#None} {try.#Success [expected (.has ..#stack {.#Some expected} environment)]})) -(def: .public (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. @@ -91,7 +91,7 @@ current (/stack.pop amount previous)] (in (.has ..#stack {.#Some current} environment))))) -(def: .public (produces amount) +(def .public (produces amount) (-> U2 Condition) (function (_ environment) (do try.monad @@ -104,7 +104,7 @@ (.has ..#stack {.#Some current}) (.has [..#limit /limit.#stack] limit)))))) -(def: .public (has registry) +(def .public (has registry) (-> Registry Condition) (|>> (revised [..#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 7702e24e7..261e9a5ce 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux @@ -26,7 +26,7 @@ #registry Registry])) (with_template [<name> <registry>] - [(def: .public (<name> type) + [(def .public (<name> type) (-> (Type Method) (Try Limit)) (do try.monad [registry (<registry> type)] @@ -37,21 +37,21 @@ [virtual /registry.virtual] ) -(def: .public length +(def .public length (all n.+ ... u2 max_stack; /stack.length ... u2 max_locals; /registry.length)) -(def: .public equivalence +(def .public equivalence (Equivalence Limit) (all product.equivalence /stack.equivalence /registry.equivalence )) -(def: .public (writer limit) +(def .public (writer limit) (Writer Limit) (all \\format#composite (/stack.writer (the #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 6e3642501..3aae9a289 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 @@ -25,17 +25,17 @@ (type: .public Register U1) -(def: normal 1) -(def: wide 2) +(def normal 1) +(def wide 2) (primitive .public Registry U2 - (def: .public registry + (def .public registry (-> U2 Registry) (|>> abstraction)) - (def: (minimal type) + (def (minimal type) (-> (Type Method) Nat) (let [[type_variables inputs output exceptions] (/////type/parser.method type)] (|> inputs @@ -47,7 +47,7 @@ (list#mix n.+ 0)))) (with_template [<start> <name>] - [(def: .public <name> + [(def .public <name> (-> (Type Method) (Try Registry)) (|>> ..minimal (n.+ <start>) @@ -58,24 +58,24 @@ [1 virtual] ) - (def: .public equivalence + (def .public equivalence (Equivalence Registry) (at equivalence.functor each (|>> representation) /////unsigned.equivalence)) - (def: .public writer + (def .public writer (Writer Registry) (|>> representation /////unsigned.writer/2)) - (def: .public (has needed) + (def .public (has needed) (-> Registry Registry Registry) (|>> representation (/////unsigned.max/2 (representation needed)) abstraction)) (with_template [<name> <extra>] - [(def: .public <name> + [(def .public <name> (-> Register Registry) (let [extra (|> <extra> /////unsigned.u2 try.trusted)] (|>> /////unsigned.lifted/2 @@ -88,5 +88,5 @@ ) ) -(def: .public 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 a3cec4224..59c3c50ce 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 @@ -21,7 +21,7 @@ U2 (with_template [<frames> <name>] - [(def: .public <name> + [(def .public <name> Stack (|> <frames> /////unsigned.u2 maybe.trusted abstraction))] @@ -29,22 +29,22 @@ [1 catch] ) - (def: .public equivalence + (def .public equivalence (Equivalence Stack) (at equivalence.functor each (|>> representation) /////unsigned.equivalence)) - (def: .public writer + (def .public writer (Writer Stack) (|>> representation /////unsigned.writer/2)) - (def: stack + (def stack (-> U2 Stack) (|>> abstraction)) (with_template [<op> <name>] - [(def: .public (<name> amount) + [(def .public (<name> amount) (-> U2 (-> Stack (Try Stack))) (|>> representation (<op> amount) @@ -54,16 +54,16 @@ [/////unsigned.-/2 pop] ) - (def: .public (max left right) + (def .public (max left right) (-> Stack Stack Stack) (abstraction (/////unsigned.max/2 (representation left) (representation right)))) - (def: .public format + (def .public format (Format Stack) (|>> representation /////unsigned.value %.nat)) ) -(def: .public 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 9345f2ec2..ca4dfcff6 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -44,18 +44,18 @@ (type: .public Estimator (-> Address Size)) -(def: fixed +(def fixed (-> Size Estimator) function.constant) (type: .public Instruction (-> Specification Specification)) -(def: .public empty +(def .public empty Instruction function.identity) -(def: .public result +(def .public result (-> Instruction Specification) (function.on \\format.no_op)) @@ -63,7 +63,7 @@ Nat) (with_template [<size> <name>] - [(def: <name> Size (|> <size> ///unsigned.u2 try.trusted))] + [(def <name> Size (|> <size> ///unsigned.u2 try.trusted))] [1 opcode_size] [1 register_size] @@ -73,14 +73,14 @@ [4 integer_size] ) -(def: (nullary' opcode) +(def (nullary' opcode) (-> Opcode Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..opcode_size) offset) (binary.has_8! offset opcode binary)])) -(def: nullary +(def nullary [Estimator (-> Opcode Instruction)] [(..fixed ..opcode_size) (function (_ opcode [size mutation]) @@ -89,7 +89,7 @@ (|>> mutation ((nullary' opcode)))])]) (with_template [<name> <size>] - [(def: <name> + [(def <name> Size (|> ..opcode_size (///unsigned.+/2 <size>) @@ -102,7 +102,7 @@ (with_template [<shift> <name> <inputT> <writer> <unwrap>] [(with_expansions [<private> (template.symbol ["'" <name>])] - (def: (<private> opcode input0) + (def (<private> opcode input0) (-> Opcode <inputT> Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value <shift>) offset) @@ -111,7 +111,7 @@ (<writer> (n.+ (///unsigned.value ..opcode_size) offset) (<unwrap> input0)))])) - (def: <name> + (def <name> [Estimator (-> Opcode <inputT> Instruction)] [(..fixed <shift>) (function (_ opcode input0 [size mutation]) @@ -126,7 +126,7 @@ (with_template [<shift> <name> <inputT> <writer>] [(with_expansions [<private> (template.symbol ["'" <name>])] - (def: (<private> opcode input0) + (def (<private> opcode input0) (-> Opcode <inputT> Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value <shift>) offset) @@ -135,7 +135,7 @@ (<writer> (n.+ (///unsigned.value ..opcode_size) offset) (///signed.value input0)))])) - (def: <name> + (def <name> [Estimator (-> Opcode <inputT> Instruction)] [(..fixed <shift>) (function (_ opcode input0 [size mutation]) @@ -146,13 +146,13 @@ [..size/2 unary/2' S2 binary.has_16!] ) -(def: size/11 +(def size/11 Size (|> ..opcode_size (///unsigned.+/2 ..register_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted)) -(def: (binary/11' opcode input0 input1) +(def (binary/11' opcode input0 input1) (-> Opcode U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/11) offset) @@ -163,20 +163,20 @@ (binary.has_8! (n.+ (///unsigned.value ..size/1) offset) (///unsigned.value input1)))])) -(def: binary/11 +(def binary/11 [Estimator (-> Opcode U1 U1 Instruction)] [(..fixed ..size/11) (function (_ opcode input0 input1 [size mutation]) [(n.+ (///unsigned.value ..size/11) size) (|>> mutation ((binary/11' opcode input0 input1)))])]) -(def: size/21 +(def size/21 Size (|> ..opcode_size (///unsigned.+/2 ..index_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted)) -(def: (binary/21' opcode input0 input1) +(def (binary/21' opcode input0 input1) (-> Opcode U2 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/21) offset) @@ -187,21 +187,21 @@ (binary.has_8! (n.+ (///unsigned.value ..size/2) offset) (///unsigned.value input1)))])) -(def: binary/21 +(def binary/21 [Estimator (-> Opcode U2 U1 Instruction)] [(..fixed ..size/21) (function (_ opcode input0 input1 [size mutation]) [(n.+ (///unsigned.value ..size/21) size) (|>> mutation ((binary/21' opcode input0 input1)))])]) -(def: size/211 +(def size/211 Size (|> ..opcode_size (///unsigned.+/2 ..index_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted (///unsigned.+/2 ..byte_size) try.trusted)) -(def: (trinary/211' opcode input0 input1 input2) +(def (trinary/211' opcode input0 input1 input2) (-> Opcode U2 U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/211) offset) @@ -214,7 +214,7 @@ (binary.has_8! (n.+ (///unsigned.value ..size/21) offset) (///unsigned.value input2)))])) -(def: trinary/211 +(def trinary/211 [Estimator (-> Opcode U2 U1 U1 Instruction)] [(..fixed ..size/211) (function (_ opcode input0 input1 input2 [size mutation]) @@ -224,12 +224,12 @@ (primitive .public Primitive_Array_Type U1 - (def: code + (def code (-> Primitive_Array_Type U1) (|>> representation)) (with_template [<code> <name>] - [(def: .public <name> + [(def .public <name> (|> <code> ///unsigned.u1 try.trusted abstraction))] [04 t_boolean] @@ -481,7 +481,7 @@ [<input_name>] <inputs>')] - (def: .public <name> + (def .public <name> [Estimator (-> [<input_types>] Instruction)] (let [[estimator <arity>'] <arity>] [estimator @@ -564,7 +564,7 @@ [["B9" invokeinterface [[index (Index (Reference Method))] [count U1] [output_count U1]] [(///index.value index) count (try.trusted (///unsigned.u1 0))]]]] )) -(def: (switch_padding offset) +(def (switch_padding offset) (-> Nat Nat) (let [parameter_start (n.+ (///unsigned.value ..opcode_size) offset)] @@ -572,7 +572,7 @@ (n.- (n.% 4 parameter_start) 4)))) -(def: .public tableswitch +(def .public tableswitch [(-> Nat Estimator) (-> S4 Big_Jump [Big_Jump (List Big_Jump)] Instruction)] (let [estimator (is (-> Nat Estimator) @@ -636,7 +636,7 @@ size) (|>> mutation tableswitch_mutation)]))))])) -(def: .public lookupswitch +(def .public lookupswitch [(-> Nat Estimator) (-> Big_Jump (List [S4 Big_Jump]) Instruction)] (let [case_size (n.+ (///unsigned.value ..integer_size) @@ -694,10 +694,10 @@ size) (|>> mutation lookupswitch_mutation)]))))])) -(def: .public monoid +(def .public monoid (Monoid Instruction) (implementation - (def: identity ..empty) + (def identity ..empty) - (def: (composite left right) + (def (composite left right) (|>> left right)))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux index 7d608a8e5..676930f65 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/jump.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/jump.lux @@ -13,17 +13,17 @@ (type: .public Jump S2) -(def: .public equivalence +(def .public equivalence (Equivalence Jump) ///signed.equivalence) -(def: .public writer +(def .public writer (Writer Jump) ///signed.writer/2) (type: .public Big_Jump S4) -(def: .public lifted +(def .public lifted (-> Jump Big_Jump) ///signed.lifted/4) diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index f93320b4c..cbbc47502 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -57,7 +57,7 @@ ["4000" enum] ) -(def: .public equivalence +(def .public equivalence (Equivalence Class) (all product.equivalence //unsigned.equivalence @@ -72,7 +72,7 @@ (sequence.equivalence //method.equivalence) (sequence.equivalence //attribute.equivalence))) -(def: (install_classes this super interfaces) +(def (install_classes this super interfaces) (-> Internal Internal (List Internal) (Resource [(Index //constant.Class) (Index //constant.Class) (Sequence (Index //constant.Class))])) (do [! //pool.monad] @@ -87,7 +87,7 @@ interfaces))] (in [@this @super @interfaces]))) -(def: .public (class version modifier +(def .public (class version modifier this signature super interfaces fields methods attributes) (-> Major (Modifier Class) @@ -127,7 +127,7 @@ {.#None} attributes)]))) -(def: .public (writer class) +(def .public (writer class) (Writer Class) (`` (all binaryF#composite (~~ (with_template [<writer> <slot>] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 8539fbf13..ebeccfaa4 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -36,28 +36,28 @@ (type: .public UTF8 Text) -(def: utf8_writer +(def utf8_writer (Writer UTF8) binaryF.utf8_16) (primitive .public Class (Index UTF8) - (def: .public index + (def .public index (-> Class (Index UTF8)) (|>> representation)) - (def: .public class + (def .public class (-> (Index UTF8) Class) (|>> abstraction)) - (def: .public class_equivalence + (def .public class_equivalence (Equivalence Class) (at equivalence.functor each ..index //index.equivalence)) - (def: class_writer + (def class_writer (Writer Class) (|>> representation //index.writer)) ) @@ -66,10 +66,10 @@ "[1]::[0]" ("static" floatToRawIntBits "manual" [float] int)) -(def: .public float_equivalence +(def .public float_equivalence (Equivalence java/lang/Float) (implementation - (def: (= parameter subject) + (def (= parameter subject) (for @.old ("jvm feq" parameter subject) @@ -85,11 +85,11 @@ (primitive .public (Value kind) kind - (def: .public value + (def .public value (All (_ kind) (-> (Value kind) kind)) (|>> representation)) - (def: .public (value_equivalence Equivalence<kind>) + (def .public (value_equivalence Equivalence<kind>) (All (_ kind) (-> (Equivalence kind) (Equivalence (Value kind)))) @@ -101,7 +101,7 @@ [(type: .public <type> (Value <marker>)) - (def: .public <constructor> + (def .public <constructor> (-> <marker> <type>) (|>> abstraction))] @@ -113,7 +113,7 @@ ) (with_template [<writer_name> <type> <write> <writer>] - [(def: <writer_name> + [(def <writer_name> (Writer <type>) (`` (|>> representation (~~ (template.spliced <write>)) @@ -138,13 +138,13 @@ #name_and_type (Index (Name_And_Type of))])) (with_template [<type> <equivalence> <writer>] - [(def: .public <equivalence> + [(def .public <equivalence> (Equivalence (<type> Any)) (all product.equivalence //index.equivalence //index.equivalence)) - (def: <writer> + (def <writer> (Writer (<type> Any)) (all binaryF.and //index.writer @@ -168,7 +168,7 @@ {#Interface_Method (Reference //category.Method)} {#Name_And_Type (Name_And_Type Any)})) -(def: .public (size constant) +(def .public (size constant) (-> Constant Nat) (case constant (^.or {#Long _} {#Double _}) @@ -177,12 +177,12 @@ _ 1)) -(def: .public 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. (implementation - (def: (= reference sample) + (def (= reference sample) (case [reference sample] (^.with_template [<tag> <equivalence>] [[{<tag> reference} {<tag> sample}] @@ -223,7 +223,7 @@ ... ) ) -(def: .public writer +(def .public writer (Writer Constant) (with_expansions [<constants> (these [#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 b953600bf..787af5c99 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -35,7 +35,7 @@ (type: .public Pool [Index (Sequence [Index Constant])]) -(def: .public equivalence +(def .public equivalence (Equivalence Pool) (product.equivalence //index.equivalence (sequence.equivalence (product.equivalence //index.equivalence @@ -44,10 +44,10 @@ (type: .public (Resource a) (+State Try Pool a)) -(def: .public functor +(def .public functor (Functor Resource) (implementation - (def: (each $ it) + (def (each $ it) (|>> it (pipe.case {try.#Success [state output]} @@ -57,16 +57,16 @@ failure (as_expected failure)))))) -(def: .public monad +(def .public monad (Monad Resource) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in it) + (def (in it) (function (_ state) {try.#Success [state it]})) - (def: (conjoint it) + (def (conjoint it) (function (_ state) (case (it state) {try.#Success [state' it']} @@ -76,7 +76,7 @@ failure (as_expected failure)))))) -(def: try|each +(def try|each (template (_ <binding> <value> <body>) [(case <value> {try.#Success <binding>} @@ -86,11 +86,11 @@ failure (as_expected failure))])) -(def: try|in +(def try|in (template (_ <it>) [{try.#Success <it>}])) -(def: !add +(def !add (template (_ <state> <tag> <equivalence> <value>) [(let [[current pool] <state> <value>' <value>] @@ -120,12 +120,12 @@ (sequence.suffix [current new] pool)] current]))))))])) -(def: /|do +(def /|do (template (_ <state> <body>) [(function (_ <state>) <body>)])) -(def: /|each +(def /|each (template (_ <state> <binding> <value> <body>) [(case (<value> <state>) {try.#Success [<state> <binding>]} @@ -139,7 +139,7 @@ (-> of (Resource (Index of)))) (with_template [<name> <type> <tag> <equivalence>] - [(def: .public (<name> value) + [(def .public (<name> value) (Adder <type>) (<| (/|do %) (!add % <tag> <equivalence> value)))] @@ -151,21 +151,21 @@ [utf8 UTF8 //.#UTF8 text.equivalence] ) -(def: .public (string value) +(def .public (string value) (-> Text (Resource (Index String))) (<| (/|do %) (/|each % @value (utf8 value)) (let [value (//.string @value)]) (!add % //.#String (//.value_equivalence //index.equivalence) value))) -(def: .public (class name) +(def .public (class name) (-> Internal (Resource (Index Class))) (<| (/|do %) (/|each % @name (utf8 (//name.read name))) (let [value (//.class @name)]) (!add % //.#Class //.class_equivalence value))) -(def: .public (descriptor value) +(def .public (descriptor value) (All (_ kind) (-> (Descriptor kind) (Resource (Index (Descriptor kind))))) @@ -178,7 +178,7 @@ [#name UTF8 #descriptor (Descriptor of)])) -(def: .public (name_and_type [name descriptor]) +(def .public (name_and_type [name descriptor]) (All (_ of) (-> (Member of) (Resource (Index (Name_And_Type of))))) (<| (/|do %) @@ -187,7 +187,7 @@ (!add % //.#Name_And_Type //.name_and_type_equivalence [//.#name @name //.#descriptor @descriptor]))) (with_template [<name> <tag> <of>] - [(def: .public (<name> class member) + [(def .public (<name> class member) (-> External (Member <of>) (Resource (Index (Reference <of>)))) (<| (/|do %) (/|each % @class (..class (//name.internal class))) @@ -199,11 +199,11 @@ [interface_method //.#Interface_Method Method] ) -(def: !index +(def !index (template (_ <index>) [(|> <index> //index.value //unsigned.value)])) -(def: .public writer +(def .public writer (Writer Pool) (function (_ [next pool]) (sequence#mix (function (_ [_index post] pre) @@ -211,7 +211,7 @@ (\\format.bits_16 (!index next)) pool))) -(def: .public empty +(def .public empty Pool [(|> 1 //unsigned.u2 try.trusted //index.index) sequence.empty]) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 2ac10790f..58684f493 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -17,15 +17,15 @@ (primitive .public Tag U1 - (def: .public equivalence + (def .public equivalence (Equivalence Tag) (implementation - (def: (= reference sample) + (def (= reference sample) (u1//= (representation reference) (representation sample))))) (with_template [<code> <name>] - [(def: .public <name> + [(def .public <name> Tag (|> <code> ///unsigned.u1 try.trusted abstraction))] @@ -45,7 +45,7 @@ [18 invoke_dynamic] ) - (def: .public 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 2a322bace..068c11a36 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux @@ -7,8 +7,8 @@ [type [primitive (.except)]]]]) -(def: .public internal_separator "/") -(def: .public external_separator ".") +(def .public internal_separator "/") +(def .public external_separator ".") (type: .public External Text) @@ -16,26 +16,26 @@ (primitive .public Internal Text - (def: .public internal + (def .public internal (-> External Internal) (|>> (text.replaced ..external_separator ..internal_separator) abstraction)) - (def: .public read + (def .public read (-> Internal Text) (|>> representation)) - (def: .public external + (def .public external (-> Internal External) (|>> representation (text.replaced ..internal_separator ..external_separator)))) -(def: .public safe +(def .public safe (-> Text External) (|>> ..internal ..external)) -(def: .public (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 822e420b2..b00ff6ba3 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -25,21 +25,21 @@ (primitive .public (Signed brand) Int - (def: .public value + (def .public value (-> (Signed Any) Int) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ brand) (Equivalence (Signed brand))) (implementation - (def: (= reference sample) + (def (= reference sample) (i.= (representation reference) (representation sample))))) - (def: .public order + (def .public order (All (_ brand) (Order (Signed brand))) (implementation - (def: equivalence ..equivalence) - (def: (< reference sample) + (def equivalence ..equivalence) + (def (< reference sample) (i.< (representation reference) (representation sample))))) (exception: .public (value_exceeds_the_scope [value Int @@ -53,18 +53,18 @@ (primitive <raw> Any) (type: .public <name> (Signed <raw>))) - (def: .public <size> <bytes>) + (def .public <size> <bytes>) - (def: .public <maximum> + (def .public <maximum> <name> (|> <bytes> (n.* i64.bits_per_byte) -- i64.mask abstraction)) - (def: .public <minimum> + (def .public <minimum> <name> (let [it (representation <maximum>)] (abstraction (-- (i.- it +0))))) - (def: .public <constructor> + (def .public <constructor> (-> Int (Try <name>)) (let [positive (representation <maximum>) negative (i64.not positive)] @@ -77,7 +77,7 @@ (exception.except ..value_exceeds_the_scope [value <size>]))))) (with_template [<abstract_operation> <concrete_operation>] - [(def: .public (<abstract_operation> parameter subject) + [(def .public (<abstract_operation> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> (<concrete_operation> (representation parameter) @@ -93,7 +93,7 @@ ) (with_template [<name> <from> <to>] - [(def: .public <name> + [(def .public <name> (-> <from> <to>) (|>> transmutation))] @@ -102,7 +102,7 @@ ) (with_template [<writer_name> <type> <writer>] - [(def: .public <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 bdda3b8a5..0d2a16d52 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -24,22 +24,22 @@ (primitive .public (Unsigned brand) Nat - (def: .public value + (def .public value (-> (Unsigned Any) Nat) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ brand) (Equivalence (Unsigned brand))) (implementation - (def: (= reference sample) + (def (= reference sample) (n.= (representation reference) (representation sample))))) - (def: .public order + (def .public order (All (_ brand) (Order (Unsigned brand))) (implementation - (def: equivalence ..equivalence) - (def: (< reference sample) + (def equivalence ..equivalence) + (def (< reference sample) (n.< (representation reference) (representation sample))))) @@ -65,25 +65,25 @@ (primitive .public <raw> Any) (type: .public <name> (Unsigned <raw>))) - (def: .public <size> <bytes>) + (def .public <size> <bytes>) - (def: .public <maximum> + (def .public <maximum> <name> (|> <bytes> (n.* i64.bits_per_byte) i64.mask abstraction)) - (def: .public (<constructor> value) + (def .public (<constructor> value) (-> Nat (Try <name>)) (if (n.> (representation <maximum>) value) (exception.except ..value_exceeds_the_maximum [(symbol <name>) value <maximum>]) {try.#Success (abstraction value)})) - (def: .public (<+> parameter subject) + (def .public (<+> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> (n.+ (representation parameter) (representation subject)))) - (def: .public (<-> parameter subject) + (def .public (<-> parameter subject) (-> <name> <name> (Try <name>)) (let [parameter' (representation parameter) subject' (representation subject)] @@ -91,7 +91,7 @@ (exception.except ..subtraction_cannot_yield_negative_value [(symbol <name>) parameter subject]) {try.#Success (abstraction (n.- parameter' subject'))}))) - (def: .public (<max> left right) + (def .public (<max> left right) (-> <name> <name> <name>) (abstraction (n.max (representation left) (representation right))))] @@ -102,7 +102,7 @@ ) (with_template [<name> <from> <to>] - [(def: .public <name> + [(def .public <name> (-> <from> <to>) (|>> transmutation))] @@ -111,7 +111,7 @@ ) (with_template [<writer_name> <type> <writer>] - [(def: .public <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 b41782db2..fa84b191b 100644 --- a/stdlib/source/library/lux/target/jvm/field.lux +++ b/stdlib/source/library/lux/target/jvm/field.lux @@ -41,7 +41,7 @@ ["4000" enum] ) -(def: .public equivalence +(def .public equivalence (Equivalence Field) (all product.equivalence modifier.equivalence @@ -49,7 +49,7 @@ //index.equivalence (sequence.equivalence //attribute.equivalence))) -(def: .public (writer field) +(def .public (writer field) (Writer Field) (`` (all binaryF#composite (~~ (with_template [<writer> <slot>] @@ -61,7 +61,7 @@ [(binaryF.sequence_16 //attribute.writer) #attributes])) ))) -(def: .public (field modifier name with_signature? type attributes) +(def .public (field modifier name with_signature? type attributes) (-> (Modifier Field) UTF8 Bit (Type Value) (Sequence 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 e3421fd14..f21318b91 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -12,27 +12,27 @@ [encoding ["[1][0]" unsigned (.only U2)]]]) -(def: .public length +(def .public length //unsigned.bytes/2) (primitive .public (Index kind) U2 - (def: .public index + (def .public index (All (_ kind) (-> U2 (Index kind))) (|>> abstraction)) - (def: .public value + (def .public value (-> (Index Any) U2) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ kind) (Equivalence (Index kind))) (at equivalence.functor each ..value //unsigned.equivalence)) - (def: .public 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 ee54b8aef..a16372f06 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -65,7 +65,7 @@ "io" "try" (java/lang/Class java/lang/Object))) (with_expansions [<elemT> (these (java/lang/Class java/lang/Object))] - (def: java/lang/ClassLoader::defineClass + (def java/lang/ClassLoader::defineClass java/lang/reflect/Method (let [signature (|> (ffi.array <elemT> 4) (ffi.write! 0 (as <elemT> @@ -80,7 +80,7 @@ (ffi.class_for java/lang/ClassLoader)) (java/lang/reflect/AccessibleObject::setAccessible true))))) -(def: .public (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) @@ -97,11 +97,11 @@ ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) -(def: .public (new_library _) +(def .public (new_library _) (-> Any Library) (atom.atom (dictionary.empty text.hash))) -(def: .public (memory library) +(def .public (memory library) (-> Library java/lang/ClassLoader) (with_expansions [<cast> (for @.old (<|) @@ -128,7 +128,7 @@ {.#None} (panic! (exception.error ..unknown [class_name]))))))))) -(def: .public (store name bytecode library) +(def .public (store name bytecode library) (-> Text Binary Library (IO (Try Any))) (do [! io.monad] [library' (atom.read! library)] @@ -138,7 +138,7 @@ [_ (atom.update! (dictionary.has name bytecode) library)] (in {try.#Success []}))))) -(def: .public (load name loader) +(def .public (load name loader) (-> Text java/lang/ClassLoader (IO (Try (java/lang/Class java/lang/Object)))) (java/lang/ClassLoader::loadClass (ffi.as_string name) loader)) diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux index 72f5ef52c..a4064361e 100644 --- a/stdlib/source/library/lux/target/jvm/magic.lux +++ b/stdlib/source/library/lux/target/jvm/magic.lux @@ -12,11 +12,11 @@ (type: .public Magic U4) -(def: .public code +(def .public code Magic (|> (hex "CAFEBABE") //unsigned.u4 try.trusted)) -(def: .public 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 bdbe58f87..082ede18b 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -52,7 +52,7 @@ ["1000" synthetic] ) -(def: .public (method modifier name with_signature? type attributes code) +(def .public (method modifier name with_signature? type attributes code) (-> (Modifier Method) UTF8 Bit (Type //category.Method) (List (Resource Attribute)) (Maybe (Bytecode Any)) (Resource Method)) (do [! //pool.monad] @@ -89,7 +89,7 @@ #descriptor @descriptor #attributes attributes]))) -(def: .public equivalence +(def .public equivalence (Equivalence Method) (all product.equivalence //modifier.equivalence @@ -98,7 +98,7 @@ (sequence.equivalence //attribute.equivalence) )) -(def: .public (writer field) +(def .public (writer field) (Writer Method) (`` (all \\format#composite (~~ (with_template [<writer> <slot>] diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 04db97f3f..1034f5cab 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -26,66 +26,66 @@ (primitive .public (Modifier of) //unsigned.U2 - (def: .public code + (def .public code (-> (Modifier Any) //unsigned.U2) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ of) (Equivalence (Modifier of))) (implementation - (def: (= reference sample) + (def (= reference sample) (at //unsigned.equivalence = (representation reference) (representation sample))))) - (def: !wrap + (def !wrap (template (_ value) [(|> value //unsigned.u2 try.trusted abstraction)])) - (def: !unwrap + (def !unwrap (template (_ value) [(|> value representation //unsigned.value)])) - (def: .public (has? sub super) + (def .public (has? sub super) (All (_ of) (-> (Modifier of) (Modifier of) Bit)) (let [sub (!unwrap sub)] (|> (!unwrap super) (i64.and sub) (at i64.equivalence = sub)))) - (def: .public monoid + (def .public monoid (All (_ of) (Monoid (Modifier of))) (implementation - (def: identity + (def identity (!wrap (hex "0000"))) - (def: (composite left right) + (def (composite left right) (!wrap (i64.or (!unwrap left) (!unwrap right)))))) - (def: .public empty + (def .public empty Modifier (at ..monoid identity)) - (def: .public writer + (def .public writer (All (_ of) (Writer (Modifier of))) (|>> representation //unsigned.writer/2)) - (def: modifier + (def modifier (-> Nat Modifier) (|>> !wrap)) ) -(def: .public modifiers +(def .public modifiers (syntax (_ [ofT <code>.any options (<>.many <code>.any)]) (with_symbols [g!modifier g!code] (in (list (` (with_template [(~ g!code) (~ g!modifier)] - [(def: (~' .public) (~ g!modifier) + [(def (~' .public) (~ g!modifier) (..Modifier (~ ofT)) ((~! ..modifier) ((~! number.hex) (~ g!code))))] diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 8369ce2f0..e09c3d85a 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -109,7 +109,7 @@ [cannot_convert_to_a_lux_type] ) -(def: .public (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.#Failure _} @@ -118,14 +118,14 @@ success success)) -(def: .public (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) sub (..load class_loader sub)] (in (java/lang/Class::isAssignableFrom sub super)))) -(def: (class' parameter reflection) +(def (class' parameter reflection) (-> (-> java/lang/reflect/Type (Try (/.Type Parameter))) java/lang/reflect/Type (Try (/.Type Class))) @@ -171,7 +171,7 @@ ... else (exception.except ..cannot_convert_to_a_lux_type [reflection]))) -(def: .public (parameter type reflection) +(def .public (parameter type reflection) (-> (-> java/lang/reflect/Type (Try (/.Type Value))) (-> java/lang/reflect/Type (Try (/.Type Parameter)))) (<| (case (ffi.as java/lang/reflect/TypeVariable reflection) @@ -218,7 +218,7 @@ _) (..class' (parameter type) reflection))) -(def: .public (type reflection) +(def .public (type reflection) (-> java/lang/reflect/Type (Try (/.Type Value))) (<| (case (ffi.as java/lang/Class reflection) {.#Some reflection} @@ -245,12 +245,12 @@ ... else (..parameter type reflection))) -(def: .public class +(def .public class (-> java/lang/reflect/Type (Try (/.Type Class))) (..class' (..parameter ..type))) -(def: .public (return reflection) +(def .public (return reflection) (-> java/lang/reflect/Type (Try (/.Type Return))) (with_expansions [<else> (these (..type reflection))] (case (ffi.as java/lang/Class reflection) @@ -286,7 +286,7 @@ (exception.report "Type" (%.type type))) -(def: .public (correspond class type) +(def .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (case type (pattern {.#Primitive (static array.type_name) (list :member:)}) @@ -346,7 +346,7 @@ [not_a_virtual_field] ) -(def: .public (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: .public deprecated? +(def .public deprecated? (-> (array.Array java/lang/annotation/Annotation) Bit) (|>> (array.list {.#None}) (list.all (|>> (ffi.as java/lang/Deprecated))) @@ -366,7 +366,7 @@ not)) (with_template [<name> <exception> <then?> <else?>] - [(def: .public (<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 18c21263c..3734c5e99 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -43,7 +43,7 @@ #super_interfaces (List (Type Class))])) (with_template [<name> <style>] - [(def: .public (<name> type) + [(def .public (<name> type) (All (_ category) (-> (Type category) (<style> category))) (let [[signature descriptor reflection] (representation type)] <name>))] @@ -52,7 +52,7 @@ [descriptor Descriptor] ) - (def: .public (reflection type) + (def .public (reflection type) (All (_ category) (-> (Type (<| Return' Value' category)) (Reflection (<| Return' Value' category)))) @@ -60,7 +60,7 @@ reflection)) (with_template [<category> <name> <signature> <descriptor> <reflection>] - [(def: .public <name> + [(def .public <name> (Type <category>) (abstraction [<signature> <descriptor> <reflection>]))] @@ -75,28 +75,28 @@ [Primitive char /signature.char /descriptor.char /reflection.char] ) - (def: .public (array type) + (def .public (array type) (-> (Type Value) (Type Array)) (abstraction [(/signature.array (..signature type)) (/descriptor.array (..descriptor type)) (/reflection.array (..reflection type))])) - (def: .public (class name parameters) + (def .public (class name parameters) (-> External (List (Type Parameter)) (Type Class)) (abstraction [(/signature.class name (list#each ..signature parameters)) (/descriptor.class name) (/reflection.class name)])) - (def: .public (declaration name variables) + (def .public (declaration name variables) (-> External (List (Type Var)) (Type Declaration)) (abstraction [(/signature.declaration name (list#each ..signature variables)) (/descriptor.declaration name) (/reflection.declaration name)])) - (def: .public (as_class type) + (def .public (as_class type) (-> (Type Declaration) (Type Class)) (abstraction (let [[signature descriptor reflection] (representation type)] @@ -104,21 +104,21 @@ (/descriptor.as_class descriptor) (/reflection.as_class reflection)]))) - (def: .public wildcard + (def .public wildcard (Type Parameter) (abstraction [/signature.wildcard /descriptor.wildcard /reflection.wildcard])) - (def: .public (var name) + (def .public (var name) (-> Text (Type Var)) (abstraction [(/signature.var name) /descriptor.var /reflection.var])) - (def: .public (lower bound) + (def .public (lower bound) (-> (Type Parameter) (Type Parameter)) (abstraction (let [[signature descriptor reflection] (representation bound)] @@ -126,7 +126,7 @@ (/descriptor.lower descriptor) (/reflection.lower reflection)]))) - (def: .public (upper bound) + (def .public (upper bound) (-> (Type Parameter) (Type Parameter)) (abstraction (let [[signature descriptor reflection] (representation bound)] @@ -134,7 +134,7 @@ (/descriptor.upper descriptor) (/reflection.upper reflection)]))) - (def: .public (method [type_variables inputs output exceptions]) + (def .public (method [type_variables inputs output exceptions]) (-> [(List (Type Var)) (List (Type Value)) (Type Return) @@ -149,21 +149,21 @@ (..descriptor output)]) (as_expected ..void)])) - (def: .public equivalence + (def .public equivalence (All (_ category) (Equivalence (Type category))) (implementation - (def: (= parameter subject) + (def (= parameter subject) (at /signature.equivalence = (..signature parameter) (..signature subject))))) - (def: .public hash + (def .public hash (All (_ category) (Hash (Type category))) (implementation - (def: equivalence ..equivalence) - (def: hash (|>> ..signature (at /signature.hash hash))))) + (def equivalence ..equivalence) + (def hash (|>> ..signature (at /signature.hash hash))))) - (def: .public (primitive? type) + (def .public (primitive? type) (-> (Type Value) (Either (Type Object) (Type Primitive))) (if (`` (or (~~ (with_template [<type>] @@ -180,7 +180,7 @@ (|> type (as (Type Primitive)) {.#Right}) (|> type (as (Type Object)) {.#Left}))) - (def: .public (void? type) + (def .public (void? type) (-> (Type Return) (Either (Type Value) (Type Void))) (if (`` (or (~~ (with_template [<type>] @@ -191,7 +191,7 @@ (|> type (as (Type Value)) {.#Left}))) ) -(def: .public (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) @@ -206,6 +206,6 @@ (at maybe.monad each (|>> //name.internal //name.external)))) {.#None}))) -(def: .public 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 89e4148c6..0ec86571b 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -27,11 +27,11 @@ (type: .public Aliasing (Dictionary Text Text)) -(def: .public fresh +(def .public fresh Aliasing (dictionary.empty text.hash)) -(def: (var aliasing) +(def (var aliasing) (-> Aliasing (Parser (Type Var))) (do <>.monad [var //parser.var'] @@ -40,7 +40,7 @@ (maybe.else var) //.var)))) -(def: (class parameter) +(def (class parameter) (-> (Parser (Type Parameter)) (Parser (Type Class))) (|> (do <>.monad [name //parser.class_name @@ -53,7 +53,7 @@ (<>.before (<text>.this //descriptor.class_suffix)))) (with_template [<name> <prefix> <bound> <constructor>] - [(def: <name> + [(def <name> (-> (Parser (Type Class)) (Parser (Type Parameter))) (|>> (<>.after (<text>.this <prefix>)) (at <>.monad each <bound>)))] @@ -62,7 +62,7 @@ [upper //signature.upper_prefix //.upper ..Upper] ) -(def: (parameter aliasing) +(def (parameter aliasing) (-> Aliasing (Parser (Type Parameter))) (<>.rec (function (_ parameter) @@ -75,7 +75,7 @@ class ))))) -(def: (value aliasing) +(def (value aliasing) (-> Aliasing (Parser (Type Value))) (<>.rec (function (_ value) @@ -85,37 +85,37 @@ (//parser.array' value) )))) -(def: (inputs aliasing) +(def (inputs aliasing) (-> Aliasing (Parser (List (Type Value)))) (|> (<>.some (..value aliasing)) (<>.after (<text>.this //signature.arguments_start)) (<>.before (<text>.this //signature.arguments_end)))) -(def: (return aliasing) +(def (return aliasing) (-> Aliasing (Parser (Type Return))) (all <>.either //parser.void (..value aliasing) )) -(def: (exception aliasing) +(def (exception aliasing) (-> Aliasing (Parser (Type Class))) (|> (..class (..parameter aliasing)) (<>.after (<text>.this //signature.exception_prefix)))) -(def: (bound aliasing) +(def (bound aliasing) (-> Aliasing (Parser (Type Class))) (do <>.monad [_ (<text>.this ":")] (..class (..parameter aliasing)))) -(def: (bound_type_var aliasing) +(def (bound_type_var aliasing) (-> Aliasing (Parser (Type Var))) (|> //parser.var_name (at <>.monad each //.var) (<>.before (<>.many (..bound aliasing))))) -(def: .public (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 08a6e1213..051f45391 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 (.only External)]]]) (with_template [<name> <box>] - [(def: .public <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/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux index 99b3987d5..3de5b4483 100644 --- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux @@ -24,12 +24,12 @@ (primitive .public (Descriptor category) Text - (def: .public descriptor + (def .public descriptor (-> (Descriptor Any) Text) (|>> representation)) (with_template [<sigil> <category> <name>] - [(def: .public <name> + [(def .public <name> (Descriptor <category>) (abstraction <sigil>))] @@ -44,26 +44,26 @@ ["C" Primitive char] ) - (def: .public class_prefix "L") - (def: .public class_suffix ";") + (def .public class_prefix "L") + (def .public class_suffix ";") - (def: .public class + (def .public class (-> External (Descriptor Class)) (|>> ///name.internal ///name.read (text.enclosed [..class_prefix ..class_suffix]) abstraction)) - (def: .public (declaration name) + (def .public (declaration name) (-> External (Descriptor Declaration)) (transmutation (..class name))) - (def: .public as_class + (def .public as_class (-> (Descriptor Declaration) (Descriptor Class)) (|>> transmutation)) (with_template [<name> <category>] - [(def: .public <name> + [(def .public <name> (Descriptor <category>) (transmutation (..class "java.lang.Object")))] @@ -72,24 +72,24 @@ [wildcard Parameter] ) - (def: .public (lower descriptor) + (def .public (lower descriptor) (-> (Descriptor Parameter) (Descriptor Parameter)) ..wildcard) - (def: .public upper + (def .public upper (-> (Descriptor Parameter) (Descriptor Parameter)) (|>> transmutation)) - (def: .public array_prefix "[") + (def .public array_prefix "[") - (def: .public array + (def .public array (-> (Descriptor Value) (Descriptor Array)) (|>> representation (format ..array_prefix) abstraction)) - (def: .public (method [inputs output]) + (def .public (method [inputs output]) (-> [(List (Descriptor Value)) (Descriptor Return)] (Descriptor Method)) @@ -100,13 +100,13 @@ (text.enclosed ["(" ")"])) (representation output)))) - (def: .public equivalence + (def .public equivalence (All (_ category) (Equivalence (Descriptor category))) (implementation - (def: (= parameter subject) + (def (= parameter subject) (text#= (representation parameter) (representation subject))))) - (def: .public 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 ea7951cee..3490eaed9 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -38,7 +38,7 @@ (type: .public Mapping (Dictionary Text Type)) -(def: .public fresh +(def .public fresh Mapping (dictionary.empty text.hash)) @@ -46,13 +46,13 @@ (exception.report "Var" (%.text var))) -(def: void +(def void (Parser (Check Type)) (<>.after //parser.void (<>#in (check#in .Any)))) (with_template [<name> <parser> <reflection>] - [(def: <name> + [(def <name> (Parser (Check Type)) (<>.after <parser> (<>#in (check#in {.#Primitive (//reflection.reflection <reflection>) {.#End}}))))] @@ -68,7 +68,7 @@ ) (with_template [<name> <parser> <box>] - [(def: <name> + [(def <name> (Parser (Check Type)) (<>.after <parser> (<>#in (check#in {.#Primitive <box> {.#End}}))))] @@ -83,7 +83,7 @@ [boxed_char //parser.char //box.char] ) -(def: primitive +(def primitive (Parser (Check Type)) (all <>.either ..boolean @@ -96,7 +96,7 @@ ..char )) -(def: boxed_primitive +(def boxed_primitive (Parser (Check Type)) (all <>.either ..boxed_boolean @@ -109,13 +109,13 @@ ..boxed_char )) -(def: wildcard +(def wildcard (Parser (Check Type)) (<>.after //parser.wildcard (<>#in (check#each product.right check.existential)))) -(def: (var mapping) +(def (var mapping) (-> Mapping (Parser (Check Type))) (do <>.monad [var //parser.var'] @@ -126,7 +126,7 @@ {.#Some type} (check#in type))))) -(def: (class' parameter) +(def (class' parameter) (-> (Parser (Check Type)) (Parser (Check Type))) (|> (do <>.monad [name //parser.class_name @@ -141,7 +141,7 @@ (<>.before (<text>.this //descriptor.class_suffix)))) (with_template [<name> <prefix> <constructor>] - [(def: <name> + [(def <name> (-> (Parser (Check Type)) (Parser (Check Type))) (|> (<>.after (<text>.this <prefix>)) ... TODO: Re-enable Lower and Upper, instead of using the simplified limit. @@ -152,7 +152,7 @@ [upper //signature.upper_prefix ..Upper] ) -(def: (parameter mapping) +(def (parameter mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ parameter) @@ -165,11 +165,11 @@ class ))))) -(def: .public class +(def .public class (-> Mapping (Parser (Check Type))) (|>> ..parameter ..class')) -(def: array +(def array (-> (Parser (Check Type)) (Parser (Check Type))) (|>> (<>#each (check#each (function (_ elementT) (case elementT @@ -192,7 +192,7 @@ (|> elementT array.Array .type))))) (<>.after (<text>.this //descriptor.array_prefix)))) -(def: .public (type mapping) +(def .public (type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) @@ -202,7 +202,7 @@ (..array type) )))) -(def: .public (boxed_type mapping) +(def .public (boxed_type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) @@ -212,21 +212,21 @@ (..array type) )))) -(def: .public (return mapping) +(def .public (return mapping) (-> Mapping (Parser (Check Type))) (all <>.either ..void (..type mapping) )) -(def: .public (boxed_return mapping) +(def .public (boxed_return mapping) (-> Mapping (Parser (Check Type))) (all <>.either ..void (..boxed_type mapping) )) -(def: .public (check operation input) +(def .public (check operation input) (All (_ a) (-> (Parser (Check a)) Text (Check a))) (case (<text>.result 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 999cb620f..9eb9db150 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 @@ ["[1][0]" name (.only External)]]]]) (with_template [<category> <name> <signature> <type>] - [(def: .public <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: .public primitive +(def .public primitive (Parser (Type Primitive)) (all <>.either ..boolean @@ -53,20 +53,20 @@ ..char )) -(def: var/head +(def var/head (format "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "_")) -(def: var/tail +(def var/tail (format var/head "0123456789$")) -(def: class/set +(def class/set (format var/tail //name.internal_separator)) (with_template [<type> <name> <head> <tail> <adapter>] - [(def: .public <name> + [(def .public <name> (Parser <type>) (at <>.functor each <adapter> (<text>.slice (<text>.and! (<text>.one_of! <head>) @@ -76,24 +76,24 @@ [Text var_name var/head var/tail function.identity] ) -(def: .public var' +(def .public var' (Parser Text) (|> ..var_name (<>.after (<text>.this //signature.var_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: .public var +(def .public var (Parser (Type Var)) (<>#each //.var ..var')) -(def: .public var? +(def .public var? (-> (Type Value) (Maybe Text)) (|>> //.signature //signature.signature (<text>.result ..var') try.maybe)) -(def: .public name +(def .public name (-> (Type Var) Text) (|>> //.signature //signature.signature @@ -101,7 +101,7 @@ try.trusted)) (with_template [<name> <prefix> <constructor>] - [(def: <name> + [(def <name> (-> (Parser (Type Parameter)) (Parser (Type Parameter))) (|>> (<>.after (<text>.this <prefix>)) (<>#each <constructor>)))] @@ -110,7 +110,7 @@ [upper //signature.upper_prefix //.upper] ) -(def: (class'' parameter) +(def (class'' parameter) (-> (Parser (Type Parameter)) (Parser [External (List (Type Parameter))])) (|> (do <>.monad [name ..class_name @@ -122,17 +122,17 @@ (<>.after (<text>.this //descriptor.class_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: class' +(def class' (-> (Parser (Type Parameter)) (Parser (Type Class))) (|>> ..class'' (at <>.monad each (product.uncurried //.class)))) -(def: .public array' +(def .public array' (-> (Parser (Type Value)) (Parser (Type Array))) (|>> (<>.after (<text>.this //descriptor.array_prefix)) (<>#each //.array))) -(def: (parameter' value) +(def (parameter' value) (-> (Parser (Type Value)) (Parser (Type Parameter))) (<>.rec (function (_ parameter) @@ -146,7 +146,7 @@ class ))))) -(def: .public value +(def .public value (Parser (Type Value)) (<>.rec (function (_ value) @@ -155,16 +155,16 @@ (..parameter' value) )))) -(def: .public parameter +(def .public parameter (Parser (Type Parameter)) (..parameter' ..value)) -(def: .public class +(def .public class (Parser (Type Class)) (..class' ..parameter)) (with_template [<name> <prefix> <constructor>] - [(def: .public <name> + [(def .public <name> (-> (Type Value) (Maybe (Type Parameter))) (|>> //.signature //signature.signature @@ -175,39 +175,39 @@ [upper? //signature.upper_prefix //.upper] ) -(def: .public read_class +(def .public read_class (-> (Type Class) [External (List (Type Parameter))]) (|>> //.signature //signature.signature (<text>.result (..class'' ..parameter)) try.trusted)) -(def: .public array +(def .public array (Parser (Type Array)) (..array' ..value)) -(def: .public object +(def .public object (Parser (Type Object)) (all <>.either ..class ..array)) -(def: inputs +(def inputs (|> (<>.some ..value) (<>.after (<text>.this //signature.arguments_start)) (<>.before (<text>.this //signature.arguments_end)))) -(def: .public return +(def .public return (Parser (Type Return)) (<>.either ..void ..value)) -(def: exception +(def exception (Parser (Type Class)) (|> ..class (<>.after (<text>.this //signature.exception_prefix)))) -(def: .public var_declaration +(def .public var_declaration (Parser [(Type Var) (Type Class)]) (do <>.monad [name ..var_name @@ -215,7 +215,7 @@ type ..class] (in [(//.var name) type]))) -(def: .public method +(def .public method (-> (Type Method) [(List (Type Var)) (List (Type Value)) @@ -239,7 +239,7 @@ try.trusted))) (with_template [<name> <category> <parser>] - [(def: .public <name> + [(def .public <name> (-> (Type Value) (Maybe <category>)) (|>> //.signature //signature.signature @@ -259,7 +259,7 @@ [object? (Type Object) ..object] ) -(def: .public declaration' +(def .public declaration' (Parser [External (List (Type Var))]) (|> (<>.and ..class_name (|> (<>.some ..var) @@ -269,7 +269,7 @@ (<>.after (<text>.this //descriptor.class_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) -(def: .public 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 7794fedc3..cfd7be86b 100644 --- a/stdlib/source/library/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux @@ -18,18 +18,18 @@ (primitive .public (Reflection category) Text - (def: .public reflection + (def .public reflection (-> (Reflection Any) Text) (|>> representation)) - (def: .public equivalence + (def .public equivalence (All (_ category) (Equivalence (Reflection category))) (implementation - (def: (= parameter subject) + (def (= parameter subject) (text#= (representation parameter) (representation subject))))) (with_template [<category> <name> <reflection>] - [(def: .public <name> + [(def .public <name> (Reflection <category>) (abstraction <reflection>))] @@ -44,19 +44,19 @@ [Primitive char "char"] ) - (def: .public class + (def .public class (-> External (Reflection Class)) (|>> abstraction)) - (def: .public (declaration name) + (def .public (declaration name) (-> External (Reflection Declaration)) (transmutation (..class name))) - (def: .public as_class + (def .public as_class (-> (Reflection Declaration) (Reflection Class)) (|>> transmutation)) - (def: .public (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 +85,7 @@ abstraction))) (with_template [<name> <category>] - [(def: .public <name> + [(def .public <name> (Reflection <category>) (transmutation (..class "java.lang.Object")))] @@ -94,11 +94,11 @@ [wildcard Parameter] ) - (def: .public (lower reflection) + (def .public (lower reflection) (-> (Reflection Parameter) (Reflection Parameter)) ..wildcard) - (def: .public upper + (def .public upper (-> (Reflection Parameter) (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 610706176..288b0a75e 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -23,12 +23,12 @@ (primitive .public (Signature category) Text - (def: .public signature + (def .public signature (-> (Signature Any) Text) (|>> representation)) (with_template [<category> <name> <descriptor>] - [(def: .public <name> + [(def .public <name> (Signature <category>) (abstraction (//descriptor.descriptor <descriptor>)))] @@ -43,18 +43,18 @@ [Primitive char //descriptor.char] ) - (def: .public array + (def .public array (-> (Signature Value) (Signature Array)) (|>> representation (format //descriptor.array_prefix) abstraction)) - (def: .public wildcard + (def .public wildcard (Signature Parameter) (abstraction "*")) (with_template [<char> <name>] - [(def: .public <name> <char>)] + [(def .public <name> <char>)] ["T" var_prefix] ["-" lower_prefix] @@ -70,7 +70,7 @@ ) (with_template [<name> <prefix>] - [(def: .public <name> + [(def .public <name> (-> (Signature Parameter) (Signature Parameter)) (|>> representation (format <prefix>) abstraction))] @@ -78,18 +78,18 @@ [upper ..upper_prefix] ) - (def: .public var + (def .public var (-> Text (Signature Var)) (|>> (text.enclosed [..var_prefix //descriptor.class_suffix]) abstraction)) - (def: .public var_name + (def .public var_name (-> (Signature Var) Text) (|>> representation (text.replaced ..var_prefix "") (text.replaced //descriptor.class_suffix ""))) - (def: .public (class name parameters) + (def .public (class name parameters) (-> External (List (Signature Parameter)) (Signature Class)) (abstraction (format //descriptor.class_prefix @@ -106,28 +106,28 @@ ..parameters_end)) //descriptor.class_suffix))) - (def: .public (declaration name variables) + (def .public (declaration name variables) (-> External (List (Signature Var)) (Signature Declaration)) (transmutation (..class name variables))) - (def: class_bound + (def class_bound (|> (..class "java.lang.Object" (list)) ..signature (format ..format_type_parameter_infix))) - (def: var_declaration/1 + (def var_declaration/1 (-> (Signature Var) Text) (|>> ..var_name (text.suffix ..class_bound))) - (def: var_declaration/+ + (def var_declaration/+ (-> (List (Signature Var)) Text) (|>> (list#each ..var_declaration/1) text.together (text.enclosed [..parameters_start ..parameters_end]))) - (def: var_declaration/* + (def var_declaration/* (-> (List (Signature Var)) Text) (|>> (pipe.case {.#End} @@ -136,7 +136,7 @@ it (..var_declaration/+ it)))) - (def: .public (inheritance variables super interfaces) + (def .public (inheritance variables super interfaces) (-> (List (Signature Var)) (Signature Class) (List (Signature Class)) (Signature Inheritance)) (abstraction (format (var_declaration/* variables) @@ -145,11 +145,11 @@ (list#each ..signature) text.together)))) - (def: .public as_class + (def .public as_class (-> (Signature Declaration) (Signature Class)) (|>> transmutation)) - (def: .public (method [type_variables inputs output exceptions]) + (def .public (method [type_variables inputs output exceptions]) (-> [(List (Signature Var)) (List (Signature Value)) (Signature Return) @@ -167,16 +167,16 @@ (list#each (|>> representation (format ..exception_prefix))) text.together)))) - (def: .public equivalence + (def .public equivalence (All (_ category) (Equivalence (Signature category))) (implementation - (def: (= parameter subject) + (def (= parameter subject) (text#= (representation parameter) (representation subject))))) - (def: .public hash + (def .public hash (All (_ category) (Hash (Signature category))) (implementation - (def: equivalence ..equivalence) - (def: hash (|>> representation text#hash)))) + (def equivalence ..equivalence) + (def hash (|>> representation text#hash)))) ) diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux index 60778c7f7..9b23f8fff 100644 --- a/stdlib/source/library/lux/target/jvm/version.lux +++ b/stdlib/source/library/lux/target/jvm/version.lux @@ -11,14 +11,14 @@ (type: .public Minor Version) (type: .public Major Version) -(def: .public default_minor +(def .public default_minor Minor (|> 0 //unsigned.u2 try.trusted)) (with_template [<number> <name>] - [(def: .public <name> + [(def .public <name> Major (|> <number> //unsigned.u2 @@ -38,5 +38,5 @@ [56 v12] ) -(def: .public writer +(def .public writer //unsigned.writer/2) |