diff options
Diffstat (limited to 'stdlib/source/library/lux/meta/target/jvm/type.lux')
-rw-r--r-- | stdlib/source/library/lux/meta/target/jvm/type.lux | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/stdlib/source/library/lux/meta/target/jvm/type.lux b/stdlib/source/library/lux/meta/target/jvm/type.lux index 0eff5b048..e1cbb4374 100644 --- a/stdlib/source/library/lux/meta/target/jvm/type.lux +++ b/stdlib/source/library/lux/meta/target/jvm/type.lux @@ -45,7 +45,9 @@ (with_template [<name> <style>] [(def .public (<name> type) - (All (_ category) (-> (Type category) (<style> category))) + (All (_ category) + (-> (Type category) + (<style> category))) (let [[signature descriptor reflection] (representation type)] <name>))] @@ -77,28 +79,32 @@ ) (def .public (array type) - (-> (Type Value) (Type Array)) + (-> (Type Value) + (Type Array)) (abstraction [(/signature.array (..signature type)) (/descriptor.array (..descriptor type)) (/reflection.array (..reflection type))])) (def .public (class name parameters) - (-> External (List (Type Parameter)) (Type Class)) + (-> 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) - (-> External (List (Type Var)) (Type Declaration)) + (-> 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) - (-> (Type Declaration) (Type Class)) + (-> (Type Declaration) + (Type Class)) (abstraction (let [[signature descriptor reflection] (representation type)] [(/signature.as_class signature) @@ -113,14 +119,16 @@ /reflection.wildcard])) (def .public (var name) - (-> Text (Type Var)) + (-> Text + (Type Var)) (abstraction [(/signature.var name) /descriptor.var /reflection.var])) (def .public (lower bound) - (-> (Type Parameter) (Type Parameter)) + (-> (Type Parameter) + (Type Parameter)) (abstraction (let [[signature descriptor reflection] (representation bound)] [(/signature.lower signature) @@ -128,7 +136,8 @@ (/reflection.lower reflection)]))) (def .public (upper bound) - (-> (Type Parameter) (Type Parameter)) + (-> (Type Parameter) + (Type Parameter)) (abstraction (let [[signature descriptor reflection] (representation bound)] [(/signature.upper signature) @@ -151,7 +160,8 @@ (as_expected ..void)])) (def .public equivalence - (All (_ category) (Equivalence (Type category))) + (All (_ category) + (Equivalence (Type category))) (implementation (def (= parameter subject) (of /signature.equivalence = @@ -159,14 +169,16 @@ (..signature subject))))) (def .public hash - (All (_ category) (Hash (Type category))) + (All (_ category) + (Hash (Type category))) (implementation (def equivalence ..equivalence) (def hash (|>> ..signature (of /signature.hash hash))))) (def .public (primitive? type) - (-> (Type Value) (Either (Type Object) - (Type Primitive))) + (-> (Type Value) + (Either (Type Object) + (Type Primitive))) (if (`` (or (,, (with_template [<type>] [(of ..equivalence = (is (Type Value) <type>) type)] @@ -182,8 +194,9 @@ (|> type (as (Type Object)) {.#Left}))) (def .public (void? type) - (-> (Type Return) (Either (Type Value) - (Type Void))) + (-> (Type Return) + (Either (Type Value) + (Type Void))) (if (`` (or (,, (with_template [<type>] [(of ..equivalence = (is (Type Return) <type>) type)] @@ -193,7 +206,8 @@ ) (def .public (class? type) - (-> (Type Value) (Maybe External)) + (-> (Type Value) + (Maybe External)) (let [repr (|> type ..descriptor /descriptor.descriptor)] (if (and (text.starts_with? /descriptor.class_prefix repr) (text.ends_with? /descriptor.class_suffix repr)) @@ -208,5 +222,6 @@ {.#None}))) (def .public format - (All (_ a) (Format (Type a))) + (All (_ of) + (Format (Type of))) (|>> ..signature /signature.signature)) |